Skip to content

Commit 1991df9

Browse files
fix: update new repo folder structure in the integration test (#143) #142
Update the repo created in the integration test to match the new setup where each request gets its own repo, defined by the sha. Closes #142
1 parent 4abf0bb commit 1991df9

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/test/java/ci/controller/CiWebhookIntegrationTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,13 @@ void successfulBuild_postsPendingThenSuccess() throws Exception {
144144
* iff all checks within the runBuild function pass, updates the status 200 "success".
145145
*/
146146

147-
// Create the repo so it passes checks
148-
Files.createDirectories(temp.resolve(REPO_ID));
149-
150-
// sets value repoParentDir in ciService to temp
147+
// Set value repoParentDir in ciService to temp
151148
ReflectionTestUtils.setField(ciService, "repoParentDir", temp.toString());
152149

150+
// Create the repo so it passes checks
151+
String sha = "0123456789abcdef0123456789abcdef01234567";
152+
Files.createDirectories(temp.resolve("test").resolve(sha).resolve(REPO_ID));
153+
153154
// Fake compilation success - when the compile function is caled always return success as true
154155
CompilationService compilationMock = mock(CompilationService.class);
155156
when(compilationMock.compile(any()))
@@ -179,7 +180,6 @@ void successfulBuild_postsPendingThenSuccess() throws Exception {
179180
})) {
180181

181182
// Building the fake payload
182-
String sha = "0123456789abcdef0123456789abcdef01234567";
183183
byte[] payloadBody = buildPayload(sha);
184184
String sig = "sha256=" + computeHMACWithSHA256(SECRET, payloadBody);
185185

@@ -209,12 +209,13 @@ void failedBuild_postsPendingThenFailure() throws Exception {
209209
* iff all the build fails, updates the status to "failure".
210210
*/
211211

212-
// Create the repo so it passes checks
213-
Files.createDirectories(temp.resolve(REPO_ID));
214-
215-
// sets value repoParentDir in ciService to temp
212+
// Set value repoParentDir in ciService to temp
216213
ReflectionTestUtils.setField(ciService, "repoParentDir", temp.toString());
217214

215+
// Create the repo so it passes checks
216+
String sha = "0123456789abcdef0123456789abcdef01234567";
217+
Files.createDirectories(temp.resolve("test").resolve(sha).resolve(REPO_ID));
218+
218219
// Fake compilation success - when the compile function is caled always return success as true
219220
CompilationService compilationMock = mock(CompilationService.class);
220221
when(compilationMock.compile(any()))
@@ -244,7 +245,6 @@ void failedBuild_postsPendingThenFailure() throws Exception {
244245
})) {
245246

246247
// Building the fake payload
247-
String sha = "0123456789abcdef0123456789abcdef01234567";
248248
byte[] payloadBody = buildPayload(sha);
249249
String sig = "sha256=" + computeHMACWithSHA256(SECRET, payloadBody);
250250

0 commit comments

Comments
 (0)