tests.system.providers.amazon.aws.utils
¶
Package Contents¶
Classes¶
Stores metadata about a variable to be fetched for AWS System Tests. |
|
This builder class ultimately constructs a TaskFlow task which is run at |
Functions¶
|
Given a Parameter name: first check for an existing Environment Variable, |
Retrieves or generates an Environment ID, validate that it is suitable, |
|
|
Accepts a tuple in the format: ('log group name', 'log stream prefix'). |
|
Attributes¶
- tests.system.providers.amazon.aws.utils.INVALID_ENV_ID_MSG :str = In order to maximize compatibility, the SYSTEM_TESTS_ENV_ID must be an alphanumeric string which...[source]¶
- tests.system.providers.amazon.aws.utils.LOWERCASE_ENV_ID_MSG :str = The provided Environment ID contains uppercase letters and will be converted to lowercase for...[source]¶
- tests.system.providers.amazon.aws.utils.NO_VALUE_MSG :str = No Value Found: Variable {key} could not be found and no default value was provided.[source]¶
- class tests.system.providers.amazon.aws.utils.Variable(name, to_split=False, delimiter=None, test_name=None)[source]¶
Stores metadata about a variable to be fetched for AWS System Tests.
- Parameters
name (str) -- The name of the variable to be fetched.
to_split (bool) -- If True, the input is a string-formatted List and needs to be split. Defaults to False.
delimiter (Optional[str]) -- If to_split is true, this will be used to split the string. Defaults to ','.
test_name (Optional[str]) -- The name of the system test that the variable is associated with.
- class tests.system.providers.amazon.aws.utils.SystemTestContextBuilder[source]¶
This builder class ultimately constructs a TaskFlow task which is run at runtime (task execution time). This task generates and stores the test ENV_ID as well as any external resources requested (e.g.g IAM Roles, VPC, etc)
- tests.system.providers.amazon.aws.utils.fetch_variable(key, default_value=None, test_name=None)[source]¶
Given a Parameter name: first check for an existing Environment Variable, then check SSM for a value. If neither are available, fall back on the optional default value.
- tests.system.providers.amazon.aws.utils.set_env_id()[source]¶
Retrieves or generates an Environment ID, validate that it is suitable, export it as an Environment Variable, and return it.
If an Environment ID has already been generated, use that. Otherwise, try to fetch it and export it as an Environment Variable. If there is not one available to fetch then generate one and export it as an Environment Variable.
- Returns
A valid System Test Environment ID.
- Return type
- tests.system.providers.amazon.aws.utils.purge_logs(test_logs, force_delete=False, retry=False, retry_times=3)[source]¶
Accepts a tuple in the format: ('log group name', 'log stream prefix'). For each log group, it will delete any log streams matching the provided prefix then if the log group is empty, delete the group. If the group is not empty that indicates there are logs not generated by the test and those are left intact. If check_log_streams is True, it will simply delete the log group regardless of log streams within that log group.
- Parameters
test_logs (List[Tuple[str, Optional[str]]]) -- A list of log_group/stream_prefix tuples to delete.
force_delete (bool) -- Whether to check log streams within the log group before removal. If True, removes the log group and all its log streams inside it
retry (bool) -- Whether to retry if the log group/stream was not found. In some cases, the log group/stream is created seconds after the main resource has been created. By default, it retries for 3 times with a 5s waiting period
retry_times (int) -- Number of retries