Skip to content

Commit db2441f

Browse files
committed
personalize wip, gcp region added
1 parent 30a8d3c commit db2441f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

gcp-region/main.test.ts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { describe, expect, it } from "bun:test";
2+
import {
3+
executeScriptInContainer,
4+
runTerraformApply,
5+
runTerraformInit,
6+
testRequiredVariables,
7+
} from "../test";
8+
9+
describe("gcp-region", async () => {
10+
await runTerraformInit(import.meta.dir);
11+
12+
testRequiredVariables(import.meta.dir, {});
13+
14+
it("default output", async () => {
15+
const state = await runTerraformApply(import.meta.dir, {});
16+
expect(state.outputs.value.value).toBe("");
17+
});
18+
19+
it("customized default", async () => {
20+
const state = await runTerraformApply(import.meta.dir, {
21+
regions: '["asia"]',
22+
default: "asia-east1-a",
23+
});
24+
expect(state.outputs.value.value).toBe("asia-east1-a");
25+
});
26+
});

personalize/main.test.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { readableStreamToText, spawn } from "bun";
12
import { describe, expect, it } from "bun:test";
23
import {
34
executeScriptInContainer,
@@ -30,5 +31,21 @@ describe("personalize", async () => {
3031
]);
3132
});
3233

33-
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 resp = await execContainer(id, ["sh", "-c", "touch ~/personalize && echo \"echo test\" > ~/personalize && chmod +x ~/personalize &&" + instance.script]);
41+
// const stdout = resp.stdout.trim().split("\n");
42+
// console.log("====== resp ==== stdout (", resp.exitCode, "):");
43+
// console.log(resp.stdout);
44+
// console.log("====== resp ==== stderr:");
45+
// console.log(resp.stderr);
46+
// console.log("======");
47+
// // const stderr = resp.stderr.trim().split("\n");
48+
// expect(resp.exitCode).toBe(0);
49+
// expect(stdout).toEqual([""]);
50+
// });
3451
});

0 commit comments

Comments
 (0)