Skip to content

Commit

Permalink
control-service: update ecr credentials integration test (#2079)
Browse files Browse the repository at this point in the history
what: added a couple of checks to the integration test to make sure
authentication credentials are present.

why: better debugging of the test should it fail.

testing: n/a

---------

Signed-off-by: mrMoZ1 <[email protected]>
Co-authored-by: github-actions <>
  • Loading branch information
Momchil Z authored May 29, 2023
1 parent e326757 commit 5b2388d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public class TestJobDeployTempCredsIT extends BaseIT {
@Value("${datajobs.docker.repositoryUrl}")
private String dockerRepositoryUrl;

@Value("datajobs.aws.serviceAccountAccessKeyId")
private String iamServiceAccountAccessKeyId;

@Value("datajobs.aws.serviceAccountSecretAccessKey")
private String iamUserServiceAccountSecretAccessKey;

private AWSCredentialsService.AWSCredentialsDTO credentialsDTO;
private AmazonECR ecrClient;
private String repositoryName;
Expand All @@ -98,6 +104,9 @@ public void setup() throws Exception {
String.format(
"/data-jobs/for-team/%s/jobs/%s",
TEST_TEAM_NAME, TEST_JOB_NAME)))));
// Check authentication credentials are filled properly before continuing test.
Assertions.assertFalse(iamServiceAccountAccessKeyId.isBlank());
Assertions.assertFalse(iamUserServiceAccountSecretAccessKey.isBlank());

this.repositoryName = dockerRepositoryUrl + "/" + TEST_JOB_NAME;
this.credentialsDTO = awsCredentialsService.createTemporaryCredentials();
Expand Down Expand Up @@ -198,14 +207,7 @@ public void testDeployment() throws Exception {
}

@AfterEach
public void cleanUp() throws Exception {
mockMvc
.perform(
delete(
String.format(
"/data-jobs/for-team/%s/jobs/%s/sources", TEST_TEAM_NAME, TEST_JOB_NAME))
.with(user("user")))
.andExpect(status().isOk());
public void deleteImage() {

// delete repository and images
DeleteRepositoryRequest request =
Expand All @@ -215,4 +217,13 @@ public void cleanUp() throws Exception {

ecrClient.deleteRepository(request);
}

@AfterEach
public void deleteDataJob() throws Exception {
mockMvc
.perform(
delete(String.format("/data-jobs/for-team/%s/jobs/%s", TEST_TEAM_NAME, TEST_JOB_NAME))
.with(user("user")))
.andExpect(status().isOk());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ datajobs.executions.logsUrl.dateFormat=unix
# Python versions supported for the purposes of the deployment integration tests
datajobs.deployment.supportedPythonVersions={3.9: {vdkImage: 'ghcr.io/versatile-data-kit-dev/versatiledatakit/quickstart-vdk:release', baseImage: 'ghcr.io/versatile-data-kit-dev/versatiledatakit/data-job-base-python-3.9:latest'}, 3.8: {vdkImage: 'registry.hub.docker.com/versatiledatakit/quickstart-vdk:pre-release', baseImage: 'versatiledatakit/data-job-base-python-3.8:latest'}}
datajobs.deployment.defaultPythonVersion=3.9

# Needed to run TestJobDeployTempCredsIt. If not using IAM user the assumeIAMRole in the test's
# property should be changed to - datajobs.aws.assumeIAMRole=false and theese can be left empty:
datajobs.aws.serviceAccountAccessKeyId=${DATAJOBS_AWS_SERVICE_ACCOUNT_ACCESS_KEY_ID:}
datajobs.aws.serviceAccountSecretAccessKey=${DATAJOBS_AWS_SERVICE_ACCOUNT_SECRET_ACCESS_KEY:}

0 comments on commit 5b2388d

Please sign in to comment.