placeholder test for jupyterlab with pip
This commit is contained in:
15
code-server/main.test.ts
Normal file
15
code-server/main.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import {
|
||||
executeScriptInContainer,
|
||||
runTerraformApply,
|
||||
runTerraformInit,
|
||||
testRequiredVariables,
|
||||
} from "../test";
|
||||
|
||||
describe("code-server", async () => {
|
||||
await runTerraformInit(import.meta.dir);
|
||||
|
||||
testRequiredVariables(import.meta.dir, {
|
||||
agent_id: "foo",
|
||||
});
|
||||
});
|
||||
@@ -6,9 +6,13 @@ import {
|
||||
testRequiredVariables,
|
||||
findResourceInstance,
|
||||
runContainer,
|
||||
TerraformState,
|
||||
execContainer,
|
||||
} from "../test";
|
||||
|
||||
const executeScriptInContainer = async (
|
||||
|
||||
// executes the coder script after installing pip
|
||||
const executeScriptInContainerWithPip = async (
|
||||
state: TerraformState,
|
||||
image: string,
|
||||
shell: string = "sh",
|
||||
@@ -19,6 +23,7 @@ const executeScriptInContainer = async (
|
||||
}> => {
|
||||
const instance = findResourceInstance(state, "coder_script");
|
||||
const id = await runContainer(image);
|
||||
const respPip = await execContainer(id, [shell, "-c", "apk add py3-pip"]);
|
||||
const resp = await execContainer(id, [shell, "-c", instance.script]);
|
||||
const stdout = resp.stdout.trim().split("\n");
|
||||
const stderr = resp.stderr.trim().split("\n");
|
||||
@@ -40,9 +45,6 @@ describe("jupyterlab", async () => {
|
||||
const state = await runTerraformApply(import.meta.dir, {
|
||||
agent_id: "foo",
|
||||
});
|
||||
|
||||
const instance = findResourceInstance(state, "coder_script");
|
||||
const id = await runContainer("alpine");
|
||||
const output = await executeScriptInContainer(state, "alpine");
|
||||
expect(output.exitCode).toBe(1);
|
||||
expect(output.stdout).toEqual([
|
||||
@@ -52,6 +54,12 @@ describe("jupyterlab", async () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// TODO: Add test that runs with pip
|
||||
// May be best to use dockerfile
|
||||
// TODO: Add faster test to run with pip3.
|
||||
// currently times out.
|
||||
// it("runs with pip3", async () => {
|
||||
// ...
|
||||
// const output = await executeScriptInContainerWithPip(state, "alpine");
|
||||
// ...
|
||||
// });
|
||||
|
||||
});
|
||||
|
||||
@@ -31,35 +31,4 @@ describe("personalize", async () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// it("runs with personalize script", async () => {
|
||||
// const state = await runTerraformApply(import.meta.dir, {
|
||||
// agent_id: "foo",
|
||||
// });
|
||||
// const instance = findResourceInstance(state, "coder_script");
|
||||
// const id = await runContainer("alpine");
|
||||
// const respInit = await execContainer(id, [
|
||||
// "sh",
|
||||
// "-c",
|
||||
// 'touch ~/personalize && echo "echo test" > ~/personalize && chmod +x ~/personalize && echo "completed touch cmds"',
|
||||
// ]);
|
||||
|
||||
// console.log("\n id = ", id, "\n");
|
||||
|
||||
// console.log("\n====== init ==== stdout (", respInit.exitCode, "):");
|
||||
// console.log(respInit.stdout);
|
||||
// console.log("====== init ==== stderr:");
|
||||
// console.log(respInit.stderr);
|
||||
// console.log("======");
|
||||
// const resp = await execContainer(id, ["sh", "-c", instance.script]);
|
||||
// console.log("====== resp ==== stdout (", resp.exitCode, "):");
|
||||
// console.log(resp.stdout);
|
||||
// console.log("====== resp ==== stderr:");
|
||||
// console.log(resp.stderr);
|
||||
// console.log("======");
|
||||
// // await new Promise((resolve) => setTimeout(resolve, 100000000000));
|
||||
// const stdout = resp.stdout.trim().split("\n");
|
||||
// const stderr = resp.stderr.trim().split("\n");
|
||||
// expect(resp.exitCode).toBe(0);
|
||||
// expect(stdout).toEqual([""]);
|
||||
// });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user