Skip to content

e2e testing - #141

Merged
davejrt merged 94 commits into
masterfrom
e2e_testing
Sep 1, 2020
Merged

davejrt merged 94 commits into
masterfrom
e2e_testing

Conversation

@davejrt

@davejrt davejrt commented Aug 21, 2020

Copy link
Copy Markdown
Contributor

This PR is an attempt at the following:

Merge the smoke tests previously written by @slimsag

Enable testing on the baremetal agents using vagrant for a clean build environment

Some things to note:

There are currently two vagrant providers configured (vagrant-google and virtualbox). Virtualbox runs the vagrant box locally on the baremetal agent, and can be used to run tests locally as well as in CI. vagrant-google will provision a GCE instance and run the tests on that server, in the event that performance is an issue or a local dev environment does not have sufficient CPU and memory.

This PR in draft uses 8cpu and 8GB of RAM for the virtualbox. After testing to address sourcegraph/sourcegraph#12996 the best I can determine is that there's an issue with virtualbox in this environment and using anymore than 8vcpus seems to degrade performance to the point where these tests don't run. As a result as part of the test a maximum of 8 cpus are used for the zoekt services in order to actually run the tests. With no more than 8vcpus I have been able to reliably have tests run in ~16 minutes and 10 minutes using the vagrant-google plugin (which runs fine without the need to modify any cpu counts on services).

Comment thread .buildkite/test-pure-docker.sh Resolved
Comment thread .buildkite/test-pure-docker.sh Resolved
Comment thread README.md Resolved
Comment thread test/pure-docker/Vagrantfile Resolved
Comment thread test/pure-docker/Vagrantfile Resolved
- |
cd /deploy-sourcegraph-docker
./deploy.sh
- "/deploy-sourcegraph-docker/test/pure-docker/smoke-test.sh"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like you have removed all of the logic I had for ensuring that permissions on volume directories hasn't changed: https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/141/files#diff-b584b34513d743c4570b69a661750e14L37-L64

We need to add this back, we can't remove it because this is a really important property to test for. The customer using this, https://app.hubspot.com/contacts/2762526/company/407948923/ does not have the ./ensure-volume.sh $VOLUME 100 invocations and that must be communicated through the upgrading docs as I said here: https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/141/files#diff-b584b34513d743c4570b69a661750e14L50-L51

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.

I have a PR with the information pending here

All of the deploy-.sh scripts that require a volume now envoke ensure-volume.sh. Is this customer running a specific fork that doesn't include that? If so, wouldn't it make more sense for them to have that script?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure how to avoid this confusion, but see the README of this repository for an explanation of what pure-docker deployments actually are:

The goal is that anyone using a container management platform other than Kubernetes (Netflix's Titus, Apache's Mesos, etc.) would be able to use this repository as a reference for how to deploy Sourcegraph.

The point being the customer in question does NOT run the scripts in this repository, and any time there are changes in volume permissions etc. they need to know about those precisely because it means they need to be able to adapt those to their deployment in their own way. It's not a fork - it's the way they were intended to consume this repository (as a reference)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The point being: we need these lines to still exist in this test somewhere, removing them means we can't in good faith release pure docker to this customer and the test becomes effectively useless

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The most obvious solution to me here is to remove the deploy.sh call above and move all of this logic (deployment and other smoke tests) directly into smoke-test.sh - I am happy to do that now if you're OK with that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Side note: It's not really clear what should be in shell commands here vs. in smoke-test.sh

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.

Personally, I am inclined to put the heavy duty tasks in the scripts ie: setting up volumes, testing and then execute those scripts in the shell commands.

Previously when I've used this harness I'd been a quick and easy way to just comment out a script in shell commands if I've wanted to run the vagrant box then ssh in to manually test or tweak things before committing them.

FYI I've moved the setup and configuration part of the test process into a new script, and the testing itself is still done with smoke-test.sh

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.

My 2c, I would think of it the same way you think about the CI pipeline yaml.

  • Steps are listed in the yaml
  • Each step is unit of work that does not know about the others

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I won't block this further because I am content with this as-is, so feel free to merge.

But the organization here still doesn't make much sense to me.

  • setup.sh doesn't install dependencies, the Vagrantfile does
  • The main property being tested by these tests is in fact the static permissions on volume directories, but we've placed that in a setup.sh file - why is testing done in a setup file? Should this be renamed to perms-test.sh?
  • smoke-test.sh relies on the work that setup.sh is doing by setting up the volume directories - when this test fails in smoke-test.sh because a container fails to come up with e.g. wrong permissions, someone will need to find setup.sh and fix permissions there. This seems not super intuitive to me.
  • servers.yaml is calling deploy.sh and is "responsible for starting the deployment" but smoke-test.sh is responsible for actually ensuring the containers came up OK?

Maybe I am missing something, but the structure that would make a lot more sense to me is:

  • servers.yaml only calls smoke-test.sh, nothing else.
  • everything in setup.sh currently goes into smoke-test.sh
  • dependency installation goes into an external script setup.sh (and thus Vagrantfile becomes something we can just copy for other test suites in the future.)

@emidoots

Copy link
Copy Markdown
Member

@davejrt @pecigonzalo I am not sure I follow what the motivation here is for using different GCP projects when running this locally vs. in CI - what is the rationale for that? I think it would make more sense to have it always run in the same GCP project always

Comment thread README.md Resolved
@emidoots

Copy link
Copy Markdown
Member

Looks pretty good, some things I'd like you to follow up on and then I'll re-review

@pecigonzalo

pecigonzalo commented Aug 29, 2020 •

Copy link
Copy Markdown
Contributor

@davejrt @pecigonzalo I am not sure I follow what the motivation here is for using different GCP projects when running this locally vs. in CI - what is the rationale for that? I think it would make more sense to have it always run in the same GCP project always

The main intention was to remove it from the production project, and then a second intention was having them in -auxiliary or something else than -ci would make it easier to distinguish dev created test vagrant machines from machine ones.
I assume the concern about using a different project is the environment drift for user tests. At the moment I dont think it will cause any issues given the test is self contained, but it is possible. We could also use a tag/metadata for that last bit and share -ci.

@emidoots

Copy link
Copy Markdown
Member

Separation of dev and CI assets for cost-accounting purposes makes sense, I didn't think of that. Thanks!

@emidoots

Copy link
Copy Markdown
Member

Last thing to address here is #141 (comment) I think

@emidoots emidoots left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

more suggestion / feedback inline here: https://github.com/sourcegraph/deploy-sourcegraph-docker/pull/141/files#r481383157

but this state is clearly better than what is in master now, so feel free to move forward on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants