open-nomad/e2e
hc-github-team-nomad-core d21d4e85cf
backport of commit ff928a804590611111763632388161dc711adf88 (#19124)
Co-authored-by: Tim Gross <tgross@hashicorp.com>
2023-11-17 15:10:23 -05:00
..
acl backport of commit ff928a804590611111763632388161dc711adf88 (#19124) 2023-11-17 15:10:23 -05:00
affinities [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
alloc_logs [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
artifact [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
auth [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
bin scripts: fix interpreter for bash (#12549) 2022-04-12 10:08:21 -04:00
clientstate client: ignore restart issued to terminal allocations (#17175) 2023-05-16 10:19:41 -05:00
connect [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
consul compliance: add headers with fixed copywrite tool (#17353) 2023-05-30 09:20:32 -05:00
consultemplate [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
csi e2e: add e2e tests for job submission api (#16841) 2023-04-12 08:36:17 -05:00
deployment [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
disconnectedclients [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
e2eutil e2e: add e2e tests for job submission api (#16841) 2023-04-12 08:36:17 -05:00
eval_priority [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
events [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
example e2e: create a v3/ set of packages for creating Nomad e2e tests (#17620) 2023-06-23 09:10:49 -05:00
execagent [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
framework [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
isolation [COMPLIANCE] Add Copyright and License Headers (#17732) 2023-06-26 11:11:17 -05:00
jobsubmissions compliance: add headers with fixed copywrite tool (#17353) 2023-05-30 09:20:32 -05:00
lifecycle [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
metrics [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
namespaces [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
networking [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
nodedrain drain: use client status to determine drain is complete (#14348) 2023-04-13 08:55:28 -04:00
nomadexec [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
operator_scheduler [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
overlap [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
oversubscription e2e: add e2e tests for job submission api (#16841) 2023-04-12 08:36:17 -05:00
parameterized [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
periodic [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
podman [COMPLIANCE] Add Copyright and License Headers (#17596) 2023-06-19 12:23:28 -04:00
quotas [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
remotetasks [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
rescheduling e2e: fix and modernize rescheduling test (#19105) (#19107) 2023-11-16 15:52:05 -05:00
scaling [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
scalingpolicies [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
scheduler_sysbatch [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
scheduler_system [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
servicediscovery [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
spread [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
taskevents [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
terraform e2e: use DNS instead of HTTP to get my_public_ipv4 (#17759) 2023-06-28 13:11:57 -05:00
ui [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
upgrades [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
v3 e2e: respect timeout value when waiting for allocs in v3. (#17800) 2023-07-10 09:47:10 +01:00
vaultcompat backport of commit 6fca4fa715fcfe5c4a214e90f72c54cda7da6efd (#18490) 2023-09-13 16:38:21 -05:00
vaultsecrets [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
volumes [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
workload_id backport of commit a3f8a52fd4b192db339540152033b94f1e010b31 (#19123) 2023-11-17 15:10:13 -05: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: fix and modernize rescheduling test (#19105) (#19107) 2023-11-16 15:52:05 -05: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.