open-nomad/e2e
Tim Gross 1335543731
ephemeral disk: `migrate` should imply `sticky` (#16826)
The `ephemeral_disk` block's `migrate` field allows for best-effort migration of
the ephemeral disk data to new nodes. The documentation says the `migrate` field
is only respected if `sticky=true`, but in fact if client ACLs are not set the
data is migrated even if `sticky=false`.

The existing behavior when client ACLs are disabled has existed since the early
implementation, so "fixing" that case now would silently break backwards
compatibility. Additionally, having `migrate` not imply `sticky` seems
nonsensical: it suggests that if we place on a new node we migrate the data but
if we place on the same node, we throw the data away!

Update so that `migrate=true` implies `sticky=true` as follows:

* The failure mode when client ACLs are enabled comes from the server not passing
  along a migration token. Update the server so that the server provides a
  migration token whenever `migrate=true` and not just when `sticky=true` too.
* Update the scheduler so that `migrate` implies `sticky`.
* Update the client so that we check for `migrate || sticky` where appropriate.
* Refactor the E2E tests to move them off the old framework and make the intention
  of the test more clear.
2023-04-07 16:33:45 -04:00
..
acl e2e/acl: export ACL resource Cleanup helpers (#16822) 2023-04-06 14:35:22 -05:00
affinities e2e: setup consul ACLs a little more correctly 2020-01-31 19:06:11 -06:00
alloc_logs cli: stream both stdout and stderr when following an alloc. (#16556) 2023-04-04 10:42:27 +01:00
artifact artifact: use specific version link for zipbomb artifact (#16513) 2023-03-16 10:18:46 -05:00
auth E2E: test enforcement of ACL system (#16796) 2023-04-06 09:11:20 -04:00
bin scripts: fix interpreter for bash (#12549) 2022-04-12 10:08:21 -04:00
clientstate Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
connect e2e: use unique names for Connect ACL Consul policy names. (#14604) 2022-09-16 13:35:40 +02:00
consul consul: restore consul token when reverting a job (#15996) 2023-02-01 14:02:45 -06:00
consultemplate renamed stanza to block for consistency with other projects (#15941) 2023-01-30 15:48:43 +01:00
csi Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
deployment e2e: setup consul ACLs a little more correctly 2020-01-31 19:06:11 -06:00
disconnectedclients e2e: disable disconnected clients test(s) (#15703) 2023-01-06 08:52:37 -06:00
e2eutil e2e: swap assert for test package in e2eutil/jobs.go (#16820) 2023-04-06 10:02:27 -05:00
eval_priority core: allow setting and propagation of eval priority on job de/registration (#11532) 2021-11-23 09:23:31 +01:00
events E2E: fix events tests (#16595) 2023-03-21 14:01:40 -07:00
example E2E: move example test to use golangs stdlib test runner (#12383) 2022-03-25 14:44:16 -04:00
execagent Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
framework e2e: mark framework package as deprecated (#16075) 2023-02-07 08:10:40 -06:00
isolation e2e fixes: cli output, timing issue, and some cleanups (#16418) 2023-03-10 13:14:51 -08:00
lifecycle chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
metrics Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
namespaces e2e fixes: cli output, timing issue, and some cleanups (#16418) 2023-03-10 13:14:51 -08:00
networking scripts: fix interpreter for bash (#12549) 2022-04-12 10:08:21 -04:00
nodedrain ephemeral disk: `migrate` should imply `sticky` (#16826) 2023-04-07 16:33:45 -04:00
nomadexec e2e: stop suppressing unexpected EOF errors 2021-05-24 13:35:08 -04:00
operator_scheduler e2e fixes: cli output, timing issue, and some cleanups (#16418) 2023-03-10 13:14:51 -08:00
overlap test: use port collision instead of cpu exhaustion (#14994) 2022-10-21 07:53:26 -07:00
oversubscription e2e: fixup oversubscription test case for jammy (#15347) 2022-11-21 12:41:55 -06:00
parameterized Add a test for parameterized summary counts 2021-03-25 11:27:09 -04:00
periodic Add a test for parameterized summary counts 2021-03-25 11:27:09 -04:00
podman e2e: ensure tests are constrained to Linux (#8990) 2020-09-30 09:43:30 -04:00
quotas gofmt all the files 2021-10-01 10:14:28 -04:00
remotetasks comment out unused consts to make linter happy 2021-04-30 08:31:31 -07:00
rescheduling e2e: account for new job stop CLI exit behaviour. 2022-02-01 14:16:37 +01:00
scaling cleanup: replace TypeToPtr helper methods with pointer.Of (#14151) 2022-08-17 18:26:34 +02:00
scalingpolicies e2e: account for new job stop CLI exit behaviour. 2022-02-01 14:16:37 +01:00
scheduler_sysbatch Allow specification of a custom job name/prefix for parameterized jobs (#14631) 2022-10-06 16:21:40 -04:00
scheduler_system e2e: Run system jobs on all datacenters (#11060) 2021-08-17 11:01:47 -04:00
servicediscovery nsd: block on removal of services (#15862) 2023-01-26 08:17:57 -06:00
spread e2e: fixup reference to exported test type (#15786) 2023-01-17 12:13:57 -06:00
taskevents e2e: use testify requires instead of t.Fatal 2021-01-26 09:14:47 -05:00
terraform E2E: test enforcement of ACL system (#16796) 2023-04-06 09:11:20 -04:00
ui Windows fixes for e2e tests (#16592) 2023-03-21 13:55:32 -07:00
upgrades script e2e/upgrades: cluster upgrade scripts 2019-09-24 14:35:45 -04:00
vaultcompat Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
vaultsecrets Update ioutil library references to os and io respectively for e2e helper nomad (#16332) 2023-03-08 09:39:03 -06:00
volumes E2E: move volume mounts test to use golang's stdlib test runner (#12788) 2022-04-26 14:28:20 -04:00
workload_id e2e: sleep to ensure logs are picked up (#16596) 2023-03-21 14:10:50 -07:00
.gitignore e2e: have TF write-out HCL for CSI volume registration (#7599) 2020-04-02 12:16:43 -04:00
README.md E2E: move example test to use golangs stdlib test runner (#12383) 2022-03-25 14:44:16 -04:00
e2e_test.go e2e: move namespaces test out of legacy framework (#13934) 2022-08-01 13:24:34 -04:00

README.md

End to End Tests

This package contains integration tests. Unlike tests alongside Nomad code, these tests expect there to already be a functional Nomad cluster accessible (either on localhost or via the NOMAD_ADDR env var).

See framework/doc.go for how to write tests.

The NOMAD_E2E=1 environment variable must be set for these tests to run.

Provisioning Test Infrastructure on AWS

The terraform/ folder has provisioning code to spin up a Nomad cluster on AWS. You'll need both Terraform and AWS credentials to setup AWS instances on which e2e tests will run. See the README for details. The number of servers and clients is configurable, as is the specific build of Nomad to deploy and the configuration file for each client and server.

Provisioning Local Clusters

To run tests against a local cluster, you'll need to make sure the following environment variables are set:

  • NOMAD_ADDR should point to one of the Nomad servers
  • CONSUL_HTTP_ADDR should point to one of the Consul servers
  • NOMAD_E2E=1

TODO: the scripts in ./bin currently work only with Terraform, it would be nice for us to have a way to deploy Nomad to Vagrant or local clusters.

Running

After completing the provisioning step above, you can set the client environment for NOMAD_ADDR and run the tests as shown below:

# from the ./e2e/terraform directory, set your client environment
# if you haven't already
$(terraform output environment)

cd ..
go test -v ./...

If you want to run a specific suite, you can specify the -suite flag as shown below. Only the suite with a matching Framework.TestSuite.Component will be run, and all others will be skipped.

go test -v -suite=Consul .

If you want to run a specific test, you'll need to regex-escape some of the test's name so that the test runner doesn't skip over framework struct method names in the full name of the tests:

go test -v . -run 'TestE2E/Consul/\*consul\.ScriptChecksE2ETest/TestGroup'
                              ^       ^             ^               ^
                              |       |             |               |
                          Component   |             |           Test func
                                      |             |
                                  Go Package      Struct

We're also in the process of migrating to "stdlib-style" tests that use the standard go testing package without a notion of "suite". You can run these with -run regexes the same way you would any other go test:

go test -v . -run TestExample/TestExample_Simple

I Want To...

...SSH Into One Of The Test Machines

You can use the Terraform output to find the IP address. The keys will in the ./terraform/keys/ directory.

ssh -i keys/nomad-e2e-*.pem ubuntu@${EC2_IP_ADDR}

Run terraform output for IP addresses and details.

...Deploy a Cluster of Mixed Nomad Versions

The variables.tf file describes the nomad_version, and nomad_local_binary variables that can be used for most circumstances. But if you want to deploy mixed Nomad versions, you can provide a list of versions in your terraform.tfvars file.

For example, if you want to provision 3 servers all using Nomad 0.12.1, and 2 Linux clients using 0.12.1 and 0.12.2, you can use the following variables:

# will be used for servers
nomad_version = "0.12.1"

# will override the nomad_version for Linux clients
nomad_version_client_linux = [
    "0.12.1",
    "0.12.2"
]

...Deploy Custom Configuration Files

Set the profile field to "custom" and put the configuration files in ./terraform/config/custom/ as described in the README.

...Deploy More Than 4 Linux Clients

Use the "custom" profile as described above.

...Change the Nomad Version After Provisioning

You can update the nomad_version variable, or simply rebuild the binary you have at the nomad_local_binary path so that Terraform picks up the changes. Then run terraform plan/terraform apply again. This will update Nomad in place, making the minimum amount of changes necessary.