@@ -33,26 +33,70 @@ const executeScriptInContainerWithPip = async (
3333 } ;
3434} ;
3535
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+
3663describe ( "jupyterlab" , async ( ) => {
3764 await runTerraformInit ( import . meta. dir ) ;
3865
3966 testRequiredVariables ( import . meta. dir , {
4067 agent_id : "foo" ,
4168 } ) ;
4269
43- it ( "fails without pipx " , async ( ) => {
70+ it ( "fails without installers " , async ( ) => {
4471 const state = await runTerraformApply ( import . meta. dir , {
4572 agent_id : "foo" ,
4673 } ) ;
4774 const output = await executeScriptInContainer ( state , "alpine" ) ;
4875 expect ( output . exitCode ) . toBe ( 1 ) ;
4976 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" ,
5380 ] ) ;
5481 } ) ;
5582
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+
56100 // TODO: Add faster test to run with pipx.
57101 // currently times out.
58102 // it("runs with pipx", async () => {
0 commit comments