tests WIP

pull/68/head
Stephen Kirby 2 years ago
parent aa849bc42e
commit 1efd11f651

@ -0,0 +1,31 @@
import { describe, expect, it } from "bun:test";
import {
executeScriptInContainer,
runTerraformApply,
runTerraformInit,
testRequiredVariables,
} from "../test";
describe("git-clone", async () => {
await runTerraformInit(import.meta.dir);
testRequiredVariables(import.meta.dir, {
agent_id: "foo",
});
it("runs with default", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
});
const output = await executeScriptInContainer(state, "alpine");
// expect(output.exitCode).toBe(0);
expect(output.stderr).toEqual([
""
]);
expect(output.stdout).toEqual([
"Authenticating with Coder...",
"",
""
]);
});
});

@ -3,14 +3,16 @@
# Automatically authenticate the user if they are not
# logged in to another deployment
echo "Logging into Coder..."
CODER_DEPLOYMENT_URL=("${CODER_DEPLOYMENT_URL}")
CODER_USER_TOKEN=("${CODER_USER_TOKEN}")
RESET='\033[0m'
BOLD='\033[0;1m'
printf "$${BOLD}Logging into Coder...\n\n$${RESET}"
echo "SESSION TOKEN : ${CODER_USER_TOKEN}"
echo "DEPLOYMENT URL: ${CODER_DEPLOYMENT_URL}"
echo ""
if ! coder list >/dev/null 2>&1; then
set +x; coder login --token="${CODER_USER_TOKEN}" --url="${CODER_DEPLOYMENT_URL}"
else
echo "You are already authenticated with coder"
echo "You are already authenticated with coder."
fi

Loading…
Cancel
Save