Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Initial setup for integration tests #80

Merged
merged 19 commits into from
Jul 29, 2020
Merged

Initial setup for integration tests #80

merged 19 commits into from
Jul 29, 2020

Conversation

cmoog
Copy link
Contributor

@cmoog cmoog commented Jul 28, 2020

Progress towards #63 https://github.com/cdr/enterprise/issues/4230

This PR introduces a new CLI testing framework modeled after https://github.com/cdr/hat.

The tentative name is tcli. Commands are executed inside docker containers to limit pollution of the host filesystem and to promote reproducibility. tcli uses a flexible and extensible Assertion API for asserting properties about the CommandResult.

View a sample usage of tcli here

Given that coder login currently requires a browser, this PR uses a workaround approach by which a session_token is acquired through a manual call to the /auth/basic/login endpoint. The test then injects the credentials into their respective configuration files within the given container manually.

@cmoog cmoog marked this pull request as ready for review July 28, 2020 19:59
@cmoog cmoog requested a review from nhooyr July 28, 2020 19:59
@cmoog cmoog force-pushed the integration-tests branch from c837730 to f4fe567 Compare July 28, 2020 23:01
@cmoog cmoog requested review from coadler and scsmithr July 29, 2020 02:47
@cmoog
Copy link
Contributor Author

cmoog commented Jul 29, 2020

This is ready to merge.

Copy link
Contributor

@scsmithr scsmithr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like the direction here. Looks like a good start for an integration testing framework.

}

// HostRunner executes command tests on the host, outside of a container
type HostRunner struct{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you foresee us using HostRunner in the coder-cli tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at the moment, but I do think it has a place in tcli as an escape hatch.

Copy link
Contributor

@scsmithr scsmithr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous comments were very minor.

@cmoog cmoog force-pushed the integration-tests branch from b2604c7 to 692b219 Compare July 29, 2020 17:35
@cmoog cmoog merged commit 433da04 into master Jul 29, 2020
@cmoog cmoog deleted the integration-tests branch July 29, 2020 18:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants