Skip to content

AwsDomainStoreTest testAwsSyncerInitBadRegion throws different exception in some CI/CD environments #3286

@Bhuff1

Description

@Bhuff1

Description
When AwsDomainStoreTest testAwsSyncerInitBadRegion runs locally it fails with an SdkClientException because it tries to make a call to an endpoint with an invalid region (e.g., https://s3.MARS.amazonaws.com/). However, in some CI/CD environments the exception is different: AwsServiceException, specifically S3Exception. These exceptions effectively mean the same thing -- a bad region (MARS) causes a connection failure.

Proposed Solution
Modify unit test to include AwsServiceException and add a finally block to ensure system properties are cleared.

catch (Exception e) {
       assertTrue(e instanceof SdkClientException || e instanceof AwsServiceException, "Expected SdkClientException or AwsServiceException, got: " + e.getClass().getName());
} finally {
        System.clearProperty(Config.PROP_PREFIX + Config.SYNC_CFG_PARAM_ROOT_PATH);
        System.clearProperty(Config.PROP_PREFIX + Config.SYNC_CFG_PARAM_AWS_ACCESS_KEY);
        System.clearProperty(Config.PROP_PREFIX + Config.SYNC_CFG_PARAM_AWS_KEY_ID);
        System.clearProperty(Config.PROP_PREFIX + Config.SYNC_CFG_PARAM_AWS_S3_REGION);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions