File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
registry/coder/modules/git-clone Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,12 @@ describe("git-clone", async () => {
30
30
url : "fake-url" ,
31
31
} ) ;
32
32
const output = await executeScriptInContainer ( state , "alpine/git" ) ;
33
- expect ( output . exitCode ) . toBe ( 128 ) ;
34
33
expect ( output . stdout ) . toEqual ( [
35
34
"Creating directory ~/fake-url..." ,
36
35
"Cloning fake-url to ~/fake-url..." ,
37
36
] ) ;
37
+ expect ( output . stderr . join ( " " ) ) . toContain ( "fatal" ) ;
38
+ expect ( output . stderr . join ( " " ) ) . toContain ( "fake-url" ) ;
38
39
} ) ;
39
40
40
41
it ( "repo_dir should match repo name for https" , async ( ) => {
@@ -244,4 +245,20 @@ describe("git-clone", async () => {
244
245
"Cloning https://github.com/michaelbrewer/repo-tests.log to ~/repo-tests.log on branch feat/branch..." ,
245
246
] ) ;
246
247
} ) ;
248
+
249
+ it ( "runs post-clone script" , async ( ) => {
250
+ const state = await runTerraformApply ( import . meta. dir , {
251
+ agent_id : "foo" ,
252
+ url : "fake-url" ,
253
+ post_clone_script : "echo 'Post-clone script executed'" ,
254
+ } ) ;
255
+ const output = await executeScriptInContainer (
256
+ state ,
257
+ "alpine/git" ,
258
+ "sh" ,
259
+ "mkdir -p ~/fake-url && echo 'existing' > ~/fake-url/file.txt" ,
260
+ ) ;
261
+ expect ( output . stdout ) . toContain ( "Running post-clone script..." ) ;
262
+ expect ( output . stdout ) . toContain ( "Post-clone script executed" ) ;
263
+ } ) ;
247
264
} ) ;
Original file line number Diff line number Diff line change @@ -64,5 +64,3 @@ if [ -n "$POST_CLONE_SCRIPT" ]; then
64
64
/tmp/post_clone.sh
65
65
rm /tmp/post_clone.sh
66
66
fi
67
-
68
- exit 0
You can’t perform that action at this time.
0 commit comments