Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control-service: update ecr credentials integration test #2079

Merged
merged 7 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:}