def _get_user_group_yaml(user_group_id): input_dict = { "USER_GROUP_ID": user_group_id, } user_group = load_elasticache_resource( "usergroup", additional_replacements=input_dict) return user_group
def _make_replication_group(yaml_name, input_dict, rg_name): rg = load_elasticache_resource( yaml_name, additional_replacements=input_dict) logging.debug(rg) reference = k8s.CustomResourceReference( CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL, rg_name, namespace="default") _ = k8s.create_custom_resource(reference, rg) resource = k8s.wait_resource_consumed_by_controller(reference, wait_periods=10) assert resource is not None return (reference, resource)
def user_password(user_password_input, elasticache_client): # inject parameters into yaml; create User in cluster user = load_elasticache_resource("user_password", additional_replacements=user_password_input) reference = k8s.CustomResourceReference( CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL, user_password_input["USER_ID"], namespace="default") _ = k8s.create_custom_resource(reference, user) resource = k8s.wait_resource_consumed_by_controller(reference) assert resource is not None yield (reference, resource) # teardown: delete in k8s, assert user does not exist in AWS k8s.delete_custom_resource(reference) sleep(DEFAULT_WAIT_SECS) assert_user_deletion(user_password_input['USER_ID'])
def user_password(user_password_input, elasticache_client): # inject parameters into yaml; create User in cluster user = load_elasticache_resource( "user_password", additional_replacements=user_password_input) reference = k8s.CustomResourceReference(CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL, user_password_input["USER_ID"], namespace="default") _ = k8s.create_custom_resource(reference, user) resource = k8s.wait_resource_consumed_by_controller(reference) assert resource is not None yield (reference, resource) # teardown: delete in k8s, assert user does not exist in AWS k8s.delete_custom_resource(reference) sleep(DEFAULT_WAIT_SECS) with pytest.raises(botocore.exceptions.ClientError, match="UserNotFound"): _ = elasticache_client.describe_users( UserId=user_password_input["USER_ID"])