Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for agent bootstrap scripts #13277

Open
dannykopping opened this issue May 15, 2024 · 3 comments
Open

Add integration tests for agent bootstrap scripts #13277

dannykopping opened this issue May 15, 2024 · 3 comments
Labels
bug risk Prone to bugs chore Non-customer facing refactors, cleanup, or technical debt. s2 Broken use cases or features (with a workaround). Only humans may set this.

Comments

@dannykopping
Copy link
Contributor

The bootstrap scripts which the provisioner uses to download and run the agent are not covered by tests, as far as I can see.

This is a fairly critical area which is instrumental to the functionality of workspaces.

We should add integration tests which, as best as we can, validate that the bootstrap scripts work as expected and that agents can be brought correctly. These tests should extend to Linux, Darwin, and Windows - as each of these platforms have idiosyncratic bootstrap requirements.

test("create docker workspace", async ({ context, page }) => {
test.skip(
true,
"creating docker containers is currently leaky. They are not cleaned up when the tests are over.",
);
requireTerraformProvisioner();
const template = await createTemplate(page, StarterTemplates.STARTER_DOCKER);
const workspaceName = await createWorkspace(page, template);
// The workspace agents must be ready before we try to interact with the workspace.
await page.waitForSelector(
`//div[@role="status"][@data-testid="agent-status-ready"]`,
{
state: "visible",
},
);
// Wait for the terminal button to be visible, and click it.
const terminalButton =
"//a[@data-testid='terminal'][normalize-space()='Terminal']";
await page.waitForSelector(terminalButton, {
state: "visible",
});
const terminal = await openTerminalWindow(
page,
context,
workspaceName,
"main",
);
await terminal.waitForSelector(
`//textarea[contains(@class,"xterm-helper-textarea")]`,
{
state: "visible",
},
);
});
is the only e2e test which seems to use the terraform provisioner, however it is skipped right now due to side-effects.

@dannykopping dannykopping added the s2 Broken use cases or features (with a workaround). Only humans may set this. label May 15, 2024
@coder-labeler coder-labeler bot added the chore Non-customer facing refactors, cleanup, or technical debt. label May 15, 2024
@johnstcn johnstcn added the bug risk Prone to bugs label May 15, 2024
@kylecarbs
Copy link
Member

These are tested:

func TestAgentScript(t *testing.T) {

@kylecarbs
Copy link
Member

Well, it's not for Windows at the moment, so this issue could be renamed. It tests the fetch and execution of the binary.

@dannykopping
Copy link
Contributor Author

Testing in isolation like this is helpful, but we really need an integration test which tests the full behaviour.

@dannykopping dannykopping changed the title Add tests for agent bootstrap scripts Add integration tests for agent bootstrap scripts May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug risk Prone to bugs chore Non-customer facing refactors, cleanup, or technical debt. s2 Broken use cases or features (with a workaround). Only humans may set this.
Projects
None yet
Development

No branches or pull requests

3 participants