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

Reintroduce test suite for install script #46718

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Sep 18, 2024

The original location of the Teleport installation script included a test suite based on Docker Compose. Add the test suite to the new location along with the original GitHub Actions workflow that ran on changes to the installation script.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

.github/workflows/test-installation.yaml Outdated Show resolved Hide resolved
assets/install-scripts/install-teleport-tests/run-test.sh Outdated Show resolved Hide resolved
assets/install-scripts/install-teleport-tests/run-test.sh Outdated Show resolved Hide resolved
assets/install-scripts/install-teleport-tests/run-test.sh Outdated Show resolved Hide resolved
test_teleport
test_tctl
test_tsh
test_tbot
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also test that fdpass-teleport is installed? That's probably a later version than 15.0.0 but I note the install script does mention it if it exists.

Although now I think on it more, I think it might be better to remove the tests for tctl, tsh and tbot - the installed does nothing specific to install those - it just installs a teleport release asset so we should only be checking that it has done that, not that the release asset contains the correct binaries - that test belongs somewhere else in the release process perhaps. Testing for the upgrader for cloud is correct as the install script has special logic for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good point. Changed.

1. Edit the `command` field of the service definition to include the following:

```yaml
bash /install.sh 15.0.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice that some of the tests have 15.1.0 instead of 15.0.0 - what determines the version that goes here?

Copy link
Contributor Author

@ptgott ptgott Oct 3, 2024

Choose a reason for hiding this comment

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

To be honest, I don't think I was thinking about this. When I first added the test environment in the private repo, 15 was the latest major version, and beyond that, I think it was pretty arbitrary.

What would be the most maintainable way to set a version here? Have run-all-tests.sh retrieve the latest release version and pass it to the install.sh script on each container using a container environment variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds reasonable and removes a maintenance burden on managing the multiple version numbers currently here.

Copy link

github-actions bot commented Oct 2, 2024

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from ff46484 to 89a10ce Compare October 3, 2024 14:59
@ptgott ptgott requested a review from camscale October 3, 2024 14:59
Copy link

github-actions bot commented Oct 3, 2024

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from 89a10ce to c3cc1f6 Compare October 7, 2024 13:40
@ptgott ptgott added the no-changelog Indicates that a PR does not require a changelog entry label Oct 7, 2024
@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from c3cc1f6 to 88b00b7 Compare October 10, 2024 19:07
@ptgott
Copy link
Contributor Author

ptgott commented Oct 15, 2024

@camscale Following up to see if I addressed your feedback. Thanks!

@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from 88b00b7 to bb4046b Compare October 15, 2024 18:45
Copy link
Contributor

@camscale camscale left a comment

Choose a reason for hiding this comment

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

I think this is fine as is, but would be better with the auto-versioning. That could be a follow-up PR if you prefer.

1. Edit the `command` field of the service definition to include the following:

```yaml
bash /install.sh 15.0.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds reasonable and removes a maintenance burden on managing the multiple version numbers currently here.

bash -c 'apt-get update;
apt-get install -y curl;
sed -E -i "s/ID_LIKE=.*$/ID_LIKE=\"ubuntu debian\"/" /etc/os-release;
bash /install.sh 15.0.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: for consistency with the rest of this file, this should have oss as an arg to the install script (I know it's the default, just that the other oss install has it explicitly)

@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from bb4046b to e7f3edd Compare December 27, 2024 17:37
@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from e7f3edd to b7f6d7c Compare January 6, 2025 15:42
ptgott added 3 commits January 7, 2025 13:17
The original location of the Teleport installation script included a
test suite based on Docker Compose. Add the test suite to the new
location along with the original GitHub Actions workflow that ran on
changes to the installation script.
- Rename the workflow
- Fix an error message
- Fix unused variable
- docker-compose.yml -> docker-compose.yaml
- Remove obsolete `version` attribute from docker-compose.yaml
- Refactor case statement in run-test.sh
- Remove unnecessary test assertions. The test doesn't need to check
  that all expected binaries are in a teleport package.
This way, we can guarantee that the release version we are installing in
tests available. Use `gh` to get the latest release number and pass the
TELEPORT_VERSION shell variable to test containers.
Get tests to pass by not specifying a Teleport version if using apt-get
with Teleport Cloud. This is because the version specified by the
`TELEPORT_VERSION` variable may not be available in the `stable/cloud`
channel.

Also remove redundant `/etc/os-release` sourcing.
@ptgott ptgott force-pushed the paul.gottschling/2024-09-18-install-tests branch from b7f6d7c to 7bafb74 Compare January 7, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants