@@ -33,26 +33,70 @@ const executeScriptInContainerWithPip = async (
33
33
} ;
34
34
} ;
35
35
36
+ // executes the coder script after installing pip
37
+ const executeScriptInContainerWithUv = async (
38
+ state : TerraformState ,
39
+ image : string ,
40
+ shell = "sh" ,
41
+ ) : Promise < {
42
+ exitCode : number ;
43
+ stdout : string [ ] ;
44
+ stderr : string [ ] ;
45
+ } > => {
46
+ const instance = findResourceInstance ( state , "coder_script" ) ;
47
+ const id = await runContainer ( image ) ;
48
+ const respPipx = await execContainer ( id , [
49
+ shell ,
50
+ "-c" ,
51
+ "apk --no-cache add uv gcc musl-dev linux-headers && uv venv" ,
52
+ ] ) ;
53
+ const resp = await execContainer ( id , [ shell , "-c" , instance . script ] ) ;
54
+ const stdout = resp . stdout . trim ( ) . split ( "\n" ) ;
55
+ const stderr = resp . stderr . trim ( ) . split ( "\n" ) ;
56
+ return {
57
+ exitCode : resp . exitCode ,
58
+ stdout,
59
+ stderr,
60
+ } ;
61
+ } ;
62
+
36
63
describe ( "jupyterlab" , async ( ) => {
37
64
await runTerraformInit ( import . meta. dir ) ;
38
65
39
66
testRequiredVariables ( import . meta. dir , {
40
67
agent_id : "foo" ,
41
68
} ) ;
42
69
43
- it ( "fails without pipx " , async ( ) => {
70
+ it ( "fails without installers " , async ( ) => {
44
71
const state = await runTerraformApply ( import . meta. dir , {
45
72
agent_id : "foo" ,
46
73
} ) ;
47
74
const output = await executeScriptInContainer ( state , "alpine" ) ;
48
75
expect ( output . exitCode ) . toBe ( 1 ) ;
49
76
expect ( output . stdout ) . toEqual ( [
50
- "\u001B[0;1mInstalling jupyterlab! " ,
51
- "pipx is not installed" ,
52
- "Please install pipx in your Dockerfile/VM image before running this script" ,
77
+ "Checking for a supported installer " ,
78
+ "No valid installer is not installed" ,
79
+ "Please install pipx or uv in your Dockerfile/VM image before running this script" ,
53
80
] ) ;
54
81
} ) ;
55
82
83
+ // TODO: Add faster test to run with uv.
84
+ // currently times out.
85
+ // it("runs with uv", async () => {
86
+ // const state = await runTerraformApply(import.meta.dir, {
87
+ // agent_id: "foo",
88
+ // });
89
+ // const output = await executeScriptInContainerWithUv(state, "python:3-alpine");
90
+ // expect(output.exitCode).toBe(0);
91
+ // expect(output.stdout).toEqual([
92
+ // "Checking for a supported installer",
93
+ // "uv is installed",
94
+ // "\u001B[0;1mInstalling jupyterlab!",
95
+ // "🥳 jupyterlab has been installed",
96
+ // "👷 Starting jupyterlab in background...check logs at /tmp/jupyterlab.log",
97
+ // ]);
98
+ // });
99
+
56
100
// TODO: Add faster test to run with pipx.
57
101
// currently times out.
58
102
// it("runs with pipx", async () => {
0 commit comments