By definition, `single-node` clusters can only consist of 1 node. Likewise,
`multi-node` clusters must have 2 or more nodes.
* Ensure `ClusterType` parameter is either `multi-node` or `single-node`.
* Ensure proper validation of `NumberOfNodes` parameter based on `ClusterType`
parameter.
* Fix existing test case that incorrectly allowed a `multi-node` cluster to
consist of 1 node.
* Add dedicated test for resizing a cluster from `single-node` to `multi-node`
and back again.
Behavior and error messages have been verified against a real AWS backend.
* Add format command to makefile
* Refactor executions to be a attribute of StateMachine
* Begin to add tests for execution history
* Add tests for failed and successful event histories, with implementations
* Add failure case to environment var check
* Skip test if in server mode and update implementation coverage
* Add conditional import for mock to cover python 2
* Refactor stop execution logic into StateMachine
* Refactor event history environment variable into settings.py
* Remove typing and os import
The `boto` library (long ago superseded by `boto3`) has not had an official
release in over two years or even a commit in the last 18 months. Importing
the package (or indirectly importing it by via `moto`) generates a deprecation
warning. Additionally, an ever-increasing number of `moto` users who have
left `boto` behind for `boto3` are still being forced to install `boto`.
This commit vendors a very small subset of the `boto` library--only the code
required by `moto` to run--into the /packages subdirectory. A README file
is included explaining the origin of the files and a recommendation for how
they can be removed entirely in a future release.
NOTE: Users of `boto` will still be able to use `moto` after this is merged.
closes#2978closes#3013closes#3170closes#3418
relates to #2950
A test added in #2401 copied the name of an existing test, preventing it
from being run. This commit renames the second test, allowing both to
be picked up by the test runner.
Original code was trying to raise a ClientError directly. Change to
appropriate Redshift exception class.
* Fix test assertion for `boto`.
* Add test coverage for `boto3`.
Previous code would raise `TypeError: 'dict_keys' object is not subscriptable`
when run under Python 3.
* Re-write code in Python 2/3 compatible way.
* Add clarifying comment.
* Add test coverage.
Supersedes #3227
The previous code was trying to raise a botocore ClientError directly, which
was actually generating a secondary AttributeError because the arguments passed
to ClientError() were incorrect.
This replaces the ClientError() call with a proper moto exception class for
Redshift and fixes the test assertions appropriately.
Supersedes #1957
* Fix:CloudWatch List metrics with dimensions
* Fix:CloudWatch List metrics with dimensions
* Fixed new cases and added more tests
Co-authored-by: usmankb <usman@krazybee.com>
(old) `boto` is no longer being developed, and importing it raises
deprecation warnings. copy Key.base_user_settable_fields in here instead
of importing boto
* Extract Duplicate Code into Helper Method
DRY up the tests and replace the arbitrary `sleep()` calls with a more
explicit check before progressing.
* Improve Testing of batch:TerminateJob
The test now confirms that the job was terminated by sandwiching a `sleep`
command between two `echo` commands. In addition to the original checks
of the terminated job status/reason, the test now asserts that only the
first echo command succeeded, confirming that the job was indeed terminated
while in progress.
* Fix Race Condition in batch:SubmitJob
The `test_submit_job` in `test_batch.py` kicks off a job, calls `describe_jobs`
in a loop until the job status returned is SUCCEEDED, and then asserts against
the logged events.
The backend code that runs the submitted job does so in a separate thread. If
the job was successful, the job status was being set to SUCCEEDED *before* the
event logs had been written to the logging backend.
As a result, it was possible for the primary thread running the test to detect
that the job was successful immediately after the secondary thread had updated
the job status but before the secondary thread had written the logs to the
logging backend. Under the right conditions, this could cause the subsequent
logging assertions in the primary thread to fail.
Additionally, the code that collected the logs from the container was using
a "dodgy hack" of time.sleep() and a modulo-based conditional that was
ultimately non-deterministic and could result in log messages being dropped
or duplicated in certain scenarios.
In order to address these issues, this commit does the following:
* Carefully re-orders any code that sets a job status or timestamp
to avoid any obvious race conditions.
* Removes the "dodgy hack" in favor of a much more straightforward
(and less error-prone) method of collecting logs from the container.
* Removes arbitrary and unnecessary calls to time.sleep()
Before applying any changes, the flaky test was failing about 12% of the
time. Putting a sleep() call between setting the `job_status` to SUCCEEDED
and collecting the logs, resulted in a 100% failure rate. Simply moving
the code that sets the job status to SUCCEEDED to the end of the code block,
dropped the failure rate to ~2%. Finally, removing the log collection
hack allowed the test suite to run ~1000 times without a single failure.
Taken in aggregate, these changes make the batch backend more deterministic
and should put the nail in the coffin of this flaky test.
Closes#3475
* Added support for EMR Security Configurations and Kerberos Attributes.
* Revised exception-raising test to work with pytest api.
* Added htmlcov to .gitignore; upgrading botocore to 1.18.17, per commit d29475e.
Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
* Add support for empty strings in non-key attributes
https://github.com/spulec/moto/issues/3339
* Nose, not pytest
* Revert "Nose, not pytest"
This reverts commit 5a3cf6c887dd9fafa49096c82cfa3a3b7f91d224.
* PUT is default action
* Fixed issue 3448 for DynamoDB update_item
* Tidied up fix for issue 3448 for DynamoDB update_item
* Reformatted fix for issue 3448 for DynamoDB update_item
* removed use of f-strings in test case as it fails in Travis CI build due to Python 2.7 support of f strings
* Fix failures with latest responses library (0.12.1)
* Detect version of responses library and supply a compatible monkey patch depending on version
* Seperate responses_mock._find_match monkey patchs depending on reponses lib version to improve readability
Co-authored-by: Guillermo Arribas <garribas@atlassian.com>