Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 2f248dd

Browse files
committed
placeholder test for jupyterlab with pip
1 parent a83cd5b commit 2f248dd

File tree

3 files changed

+29
-37
lines changed

3 files changed

+29
-37
lines changed

code-server/main.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { describe, expect, it } from "bun:test";
2+
import {
3+
executeScriptInContainer,
4+
runTerraformApply,
5+
runTerraformInit,
6+
testRequiredVariables,
7+
} from "../test";
8+
9+
describe("code-server", async () => {
10+
await runTerraformInit(import.meta.dir);
11+
12+
testRequiredVariables(import.meta.dir, {
13+
agent_id: "foo",
14+
});
15+
});

jupyterlab/main.test.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ import {
66
testRequiredVariables,
77
findResourceInstance,
88
runContainer,
9+
TerraformState,
10+
execContainer,
911
} from "../test";
1012

11-
const executeScriptInContainer = async (
13+
14+
// executes the coder script after installing pip
15+
const executeScriptInContainerWithPip = async (
1216
state: TerraformState,
1317
image: string,
1418
shell: string = "sh",
@@ -19,6 +23,7 @@ const executeScriptInContainer = async (
1923
}> => {
2024
const instance = findResourceInstance(state, "coder_script");
2125
const id = await runContainer(image);
26+
const respPip = await execContainer(id, [shell, "-c", "apk add py3-pip"]);
2227
const resp = await execContainer(id, [shell, "-c", instance.script]);
2328
const stdout = resp.stdout.trim().split("\n");
2429
const stderr = resp.stderr.trim().split("\n");
@@ -40,9 +45,6 @@ describe("jupyterlab", async () => {
4045
const state = await runTerraformApply(import.meta.dir, {
4146
agent_id: "foo",
4247
});
43-
44-
const instance = findResourceInstance(state, "coder_script");
45-
const id = await runContainer("alpine");
4648
const output = await executeScriptInContainer(state, "alpine");
4749
expect(output.exitCode).toBe(1);
4850
expect(output.stdout).toEqual([
@@ -52,6 +54,12 @@ describe("jupyterlab", async () => {
5254
]);
5355
});
5456

55-
// TODO: Add test that runs with pip
56-
// May be best to use dockerfile
57+
// TODO: Add faster test to run with pip3.
58+
// currently times out.
59+
// it("runs with pip3", async () => {
60+
// ...
61+
// const output = await executeScriptInContainerWithPip(state, "alpine");
62+
// ...
63+
// });
64+
5765
});

personalize/main.test.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,35 +31,4 @@ describe("personalize", async () => {
3131
]);
3232
});
3333

34-
// it("runs with personalize script", async () => {
35-
// const state = await runTerraformApply(import.meta.dir, {
36-
// agent_id: "foo",
37-
// });
38-
// const instance = findResourceInstance(state, "coder_script");
39-
// const id = await runContainer("alpine");
40-
// const respInit = await execContainer(id, [
41-
// "sh",
42-
// "-c",
43-
// 'touch ~/personalize && echo "echo test" > ~/personalize && chmod +x ~/personalize && echo "completed touch cmds"',
44-
// ]);
45-
46-
// console.log("\n id = ", id, "\n");
47-
48-
// console.log("\n====== init ==== stdout (", respInit.exitCode, "):");
49-
// console.log(respInit.stdout);
50-
// console.log("====== init ==== stderr:");
51-
// console.log(respInit.stderr);
52-
// console.log("======");
53-
// const resp = await execContainer(id, ["sh", "-c", instance.script]);
54-
// console.log("====== resp ==== stdout (", resp.exitCode, "):");
55-
// console.log(resp.stdout);
56-
// console.log("====== resp ==== stderr:");
57-
// console.log(resp.stderr);
58-
// console.log("======");
59-
// // await new Promise((resolve) => setTimeout(resolve, 100000000000));
60-
// const stdout = resp.stdout.trim().split("\n");
61-
// const stderr = resp.stderr.trim().split("\n");
62-
// expect(resp.exitCode).toBe(0);
63-
// expect(stdout).toEqual([""]);
64-
// });
6534
});

0 commit comments

Comments
 (0)