diff --git a/src/test/java/ci/controller/CiWebhookIntegrationTest.java b/src/test/java/ci/controller/CiWebhookIntegrationTest.java index f29df24..7aeb62d 100644 --- a/src/test/java/ci/controller/CiWebhookIntegrationTest.java +++ b/src/test/java/ci/controller/CiWebhookIntegrationTest.java @@ -144,12 +144,13 @@ void successfulBuild_postsPendingThenSuccess() throws Exception { * iff all checks within the runBuild function pass, updates the status 200 "success". */ - // Create the repo so it passes checks - Files.createDirectories(temp.resolve(REPO_ID)); - - // sets value repoParentDir in ciService to temp + // Set value repoParentDir in ciService to temp ReflectionTestUtils.setField(ciService, "repoParentDir", temp.toString()); + // Create the repo so it passes checks + String sha = "0123456789abcdef0123456789abcdef01234567"; + Files.createDirectories(temp.resolve("test").resolve(sha).resolve(REPO_ID)); + // Fake compilation success - when the compile function is caled always return success as true CompilationService compilationMock = mock(CompilationService.class); when(compilationMock.compile(any())) @@ -179,7 +180,6 @@ void successfulBuild_postsPendingThenSuccess() throws Exception { })) { // Building the fake payload - String sha = "0123456789abcdef0123456789abcdef01234567"; byte[] payloadBody = buildPayload(sha); String sig = "sha256=" + computeHMACWithSHA256(SECRET, payloadBody); @@ -209,12 +209,13 @@ void failedBuild_postsPendingThenFailure() throws Exception { * iff all the build fails, updates the status to "failure". */ - // Create the repo so it passes checks - Files.createDirectories(temp.resolve(REPO_ID)); - - // sets value repoParentDir in ciService to temp + // Set value repoParentDir in ciService to temp ReflectionTestUtils.setField(ciService, "repoParentDir", temp.toString()); + // Create the repo so it passes checks + String sha = "0123456789abcdef0123456789abcdef01234567"; + Files.createDirectories(temp.resolve("test").resolve(sha).resolve(REPO_ID)); + // Fake compilation success - when the compile function is caled always return success as true CompilationService compilationMock = mock(CompilationService.class); when(compilationMock.compile(any())) @@ -244,7 +245,6 @@ void failedBuild_postsPendingThenFailure() throws Exception { })) { // Building the fake payload - String sha = "0123456789abcdef0123456789abcdef01234567"; byte[] payloadBody = buildPayload(sha); String sig = "sha256=" + computeHMACWithSHA256(SECRET, payloadBody);