Skip to content

introduce new integration test suite - #6479

Merged
vito merged 26 commits into
concourse:masterfrom
vito:ops-tests
Jan 29, 2021
Merged

vito merged 26 commits into
concourse:masterfrom
vito:ops-tests

Conversation

@vito

@vito vito commented Jan 27, 2021

Copy link
Copy Markdown
Contributor

What does this PR accomplish?

This new test suite aims to consolidate the following CI jobs / test suites:

  • upgrade
  • downgrade
  • bosh-topgun-*
  • k8s-topgun-*
  • testflight

These tests are easy to run on a dev machine: just run go test ./integration/.... They work by using docker-compose, so you don't need BOSH or K8s.

Changes proposed by this PR:

Included so far are tests covering upgrade/downgrade, so we can replace the upgrade and downgrade jobs in the pipeline, along with a Vault test suite which should let us remove the Vault tests from TopGun.

We should add more test coverage for different auth flows before removing the Vault tests from TopGun, though - this suite doesn't provide equivalent coverage yet. Only enough to verify that Vault works. The TopGun failures are actually because it's running against a ridiculously old version of Vault (v0.7.3), because it uses the world's best Vault bosh release, vito/vault-boshrelease. Now that we can test Vault using Docker Compose, we can eliminate our dependency on that release and even CI against new vault Docker images as they're released.

I think we should probably still have some sort of coverage for BOSH/K8s, but it should probably be reduced to only tests that are K8s or BOSH-specific - maybe they can even be unit tests. We should be able to test the same Concourse-specific lifecycle behavior through Docker Compose.

As for testflight, there's no immediate need to pull it in, but if we want to it could probably be tucked under integration/core as a suite that runs against a single Docker Compose deployment.

Notes to reviewer:

I went through a bit of churn while figuring out the simplest and clearest way to structure all this, so it's probably best to look at the whole diff as some commits may be made irrelevant by later commits. Let me know if anything seems really confusing! I also want to write a README under integration/ so any feedback you have would help me write it.

Contributor Checklist

Reviewer Checklist

  • Code reviewed
  • Tests reviewed
  • Documentation reviewed
  • Release notes reviewed
  • PR acceptance performed
  • New config flags added? Ensure that they are added to the
    BOSH and
    Helm packaging; otherwise, ignored for
    the integration
    tests

    (for example, if they are Garden configs that are not displayed in the
    --help text).

@vito vito added the misc label Jan 27, 2021
@vito
vito requested review from aoldershaw and xtremerui January 27, 2021 17:24
Comment thread Dockerfile
ARG base_image=concourse/dev
FROM ${base_image} AS base

# generate keys (with 1024 bits just so they generate faster)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These keys are now checked in, so they don't need to be generated in dev builds anymore. This makes it easier to run the tests against both 'dev' images and 'latest' Concourse images (e.g. upgrade/downgrade tests).

Comment thread cmd/concourse/main.go Resolved
aoldershaw added a commit that referenced this pull request Jan 28, 2021
After #6115 was merged, all the Bosh Topgun tests exercising Vault
started failing. This is not due to the Vault integration being broken
(well, not really) - Bosh topgun is just using such an old (custom)
version of Vault that is no longer compatible I gather.

Since we're going to end up replacing all these tests shortly with a new
test suite (introduced in #6479), let's just skip these Vault tests for
now

Signed-off-by: Aidan Oldershaw <[email protected]>
@aoldershaw aoldershaw mentioned this pull request Jan 28, 2021
11 tasks

@aoldershaw aoldershaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just done a really quick pass, but looks really cool so far! Really like how the tests are structured. The xyztest.Cmd approach seems to be a really nice level of indirection - the tests are very readable and seem easy to write. I'm excited to extend this suite to add more high-level test coverage!

There are a couple tests that are failing for me when running locally - any ideas what might be causing that?

Comment thread integration/creds/creds_test.go Resolved
Comment thread integration/ops/suite_test.go Resolved
Comment thread integration/internal/dctest/cmd.go Resolved
Comment thread integration/internal/dctest/cmd.go Resolved
Comment thread hack/overrides/dev.yml Resolved
Comment thread integration/internal/cmdtest/cmd.go Resolved
Comment thread integration/internal/cmdtest/cmd.go Resolved
vito added 16 commits January 28, 2021 17:08
TODO:

* break OpsSuite up so the tests can be run in parallel
* naming: integration/ops/ vs. acceptance/?

Signed-off-by: Alex Suraci <[email protected]>
the shorter assertions are nice, but it can't really be parallelized.
if we want the shorter assertions back we can convert each test into a
suite. 🤷

Signed-off-by: Alex Suraci <[email protected]>
netgo/osusergo aren't needed now that we build with CGO_ENABLED=0, and
-a shouldn't be needed either way (seems like it'd just slow down
compilation)

Signed-off-by: Alex Suraci <[email protected]>
was never actually needed, and we can just assert using t anyhow

Signed-off-by: Alex Suraci <[email protected]>
it's pretty dope

(technically this is a partial commit that breaks existing code, but i
wanted this to be separate 'cause it's cool, and i can't add -p the
other changes because the code entirely moved)

Signed-off-by: Alex Suraci <[email protected]>
pattern: for cli 'foo', have a 'footest.Init' which returns a
'footest.Cmd' which is a cmdtest.Cmd but with CLI-specific helper
methods attached

Signed-off-by: Alex Suraci <[email protected]>
only used by one suite, but follows the pattern and feels cleaner!

Signed-off-by: Alex Suraci <[email protected]>
* rather than generating keys in the 'Dockerfile', which is slow and
  makes the image behave differently from the dev or shipped images,
  just check them in. (obviously do not use these - or any of this
  workflow - in production.)
* same for vault certs, to make vault testing easier.
* move port mappings and '.' mapping to hack/overrides/dev.yml, which is
  now symlinked to docker-compose.override.yml to maintain the previous
  'docker-compose up' dev workflow.

this will make it easier to re-use docker-compose.yml for dev images and
for testing against final images. the aim here is to avoid ha

Signed-off-by: Alex Suraci <[email protected]>
now that this might be running in multiple packages

Signed-off-by: Alex Suraci <[email protected]>
Signed-off-by: Alex Suraci <[email protected]>
just makes a cold run slightly easier, even though this won't always be
perfect

Signed-off-by: Alex Suraci <[email protected]>
the logic here was wrong, and this is an unnecessary optimization anyway

Signed-off-by: Alex Suraci <[email protected]>
...primarily to make it easier to identify which subpackages are actual
test suites.

Signed-off-by: Alex Suraci <[email protected]>
vito added 2 commits January 28, 2021 17:08
overloading the outer docker-compose.yml for both dev and test started
to feel more confusing than just keeping them separate.

namely, it's impossible to un-set 'build:' in an override file, so I
split that out into a docker-compose.override.yml file, symlinked under
hack/overrides/ to keep ./hack/dc working, but then having the tests
*not* use it, even though they use the docker-compose.yml right next to
it, and even though it's normally respected by 'docker-compose'
commands.

Signed-off-by: Alex Suraci <[email protected]>
vito and others added 8 commits January 28, 2021 20:37
without this, running docker-compose in a Concourse task would fail with
a cryptic error:

  [2558] Cannot open self /tmp/build/e55deab7/concourse/integration/ops/docker-compose or archive /tmp/build/e55deab7/concourse/integration/ops/docker-compose.pkg

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Rui Yang <[email protected]>
(though it might make sense to just make this flag the default behavior)

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Rui Yang <[email protected]>
let go test ./... handle the buffering and only show output when a
package fails

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Rui Yang <[email protected]>
...not just the tag, to be consistent with how the other images are
specified

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Rui Yang <[email protected]>
so we can CI it!

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Rui Yang <[email protected]>
not used in anything; just useful for troubleshooting

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Aidan Oldershaw <[email protected]>
this is more trouble than it's worth, and the test was originally
introduced alongside explicit config for garden DNS - without that, this
is not very reliable on developer machines (due to weird WSL2/Docker for
Mac DNS)

Signed-off-by: Alex Suraci <[email protected]>
Co-authored-by: Aidan Oldershaw <[email protected]>
* use .ExpectExit(1) to expect it to exit(1)
* use .Try/.TryOutput/.TryOutputJSON to use the error return value
  yourself instead

this shortens almost all usage of it since they no longer need to
require.NoError

Signed-off-by: Alex Suraci <[email protected]>

@aoldershaw aoldershaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Having Cmd.Run assert on the error makes things really nice. Everything LGTM!

@vito
vito merged commit b83dd41 into concourse:master Jan 29, 2021
@vito
vito deleted the ops-tests branch January 29, 2021 15:10
@aoldershaw aoldershaw mentioned this pull request Feb 3, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants