• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

affinities/H17-May-2021-256200

bin/H17-May-2021-3423

cli/H17-May-2021-1,014819

clientstate/H17-May-2021-523379

connect/H17-May-2021-1,4021,049

consul/H17-May-2021-3,5722,705

consulacls/H17-May-2021-730489

consultemplate/H17-May-2021-733564

csi/H17-May-2021-906692

deployment/H17-May-2021-212162

e2eutil/H17-May-2021-1,5851,209

events/H17-May-2021-375285

example/H17-May-2021-4133

execagent/H17-May-2021-265207

framework/H17-May-2021-711391

isolation/H17-May-2021-566450

lifecycle/H17-May-2021-539414

metrics/H17-May-2021-748580

namespaces/H17-May-2021-273208

networking/H17-May-2021-4334

nodedrain/H17-May-2021-497382

nomad09upgrade/H17-May-2021-309237

nomadexec/H17-May-2021-177139

oversubscription/H17-May-2021-200153

parameterized/H17-May-2021-11892

periodic/H17-May-2021-11085

podman/H17-May-2021-11589

quotas/H17-May-2021-41

remotetasks/H17-May-2021-480367

rescheduling/H17-May-2021-985754

scaling/H17-May-2021-306221

scalingpolicies/H17-May-2021-292220

spread/H17-May-2021-204163

systemsched/H17-May-2021-222159

taskevents/H17-May-2021-314228

terraform/H17-May-2021-3,8952,922

upgrades/H17-May-2021-303190

vaultcompat/H17-May-2021-520389

vaultsecrets/H17-May-2021-357264

volumes/H17-May-2021-245192

.gitignoreH A D17-May-202118 21

README.mdH A D17-May-20213.9 KiB11884

e2e_test.goH A D17-May-20211.8 KiB5244

README.md

1# End to End Tests
2
3This package contains integration tests. Unlike tests alongside Nomad code,
4these tests expect there to already be a functional Nomad cluster accessible
5(either on localhost or via the `NOMAD_ADDR` env var).
6
7See [`framework/doc.go`](framework/doc.go) for how to write tests.
8
9The `NOMAD_E2E=1` environment variable must be set for these tests to run.
10
11## Provisioning Test Infrastructure on AWS
12
13The `terraform/` folder has provisioning code to spin up a Nomad cluster on
14AWS. You'll need both Terraform and AWS credentials to setup AWS instances on
15which e2e tests will run. See the
16[README](https://github.com/hashicorp/nomad/blob/main/e2e/terraform/README.md)
17for details. The number of servers and clients is configurable, as is the
18specific build of Nomad to deploy and the configuration file for each client
19and server.
20
21## Provisioning Local Clusters
22
23To run tests against a local cluster, you'll need to make sure the following
24environment variables are set:
25
26* `NOMAD_ADDR` should point to one of the Nomad servers
27* `CONSUL_HTTP_ADDR` should point to one of the Consul servers
28* `NOMAD_E2E=1`
29
30_TODO: the scripts in `./bin` currently work only with Terraform, it would be
31nice for us to have a way to deploy Nomad to Vagrant or local clusters._
32
33## Running
34
35After completing the provisioning step above, you can set the client
36environment for `NOMAD_ADDR` and run the tests as shown below:
37
38```sh
39# from the ./e2e/terraform directory, set your client environment
40# if you haven't already
41$(terraform output environment)
42
43cd ..
44go test -v .
45```
46
47If you want to run a specific suite, you can specify the `-suite` flag as
48shown below. Only the suite with a matching `Framework.TestSuite.Component`
49will be run, and all others will be skipped.
50
51```sh
52go test -v -suite=Consul .
53```
54
55If you want to run a specific test, you'll need to regex-escape some of the
56test's name so that the test runner doesn't skip over framework struct method
57names in the full name of the tests:
58
59```sh
60go test -v . -run 'TestE2E/Consul/\*consul\.ScriptChecksE2ETest/TestGroup'
61                              ^       ^             ^               ^
62                              |       |             |               |
63                          Component   |             |           Test func
64                                      |             |
65                                  Go Package      Struct
66```
67
68## I Want To...
69
70### ...SSH Into One Of The Test Machines
71
72You can use the Terraform output to find the IP address. The keys will
73in the `./terraform/keys/` directory.
74
75```sh
76ssh -i keys/nomad-e2e-*.pem ubuntu@${EC2_IP_ADDR}
77```
78
79Run `terraform output` for IP addresses and details.
80
81### ...Deploy a Cluster of Mixed Nomad Versions
82
83The `variables.tf` file describes the `nomad_version`, and
84`nomad_local_binary` variables that can be used for most circumstances. But if
85you want to deploy mixed Nomad versions, you can provide a list of versions in
86your `terraform.tfvars` file.
87
88For example, if you want to provision 3 servers all using Nomad 0.12.1, and 2
89Linux clients using 0.12.1 and 0.12.2, you can use the following variables:
90
91```hcl
92# will be used for servers
93nomad_version = "0.12.1"
94
95# will override the nomad_version for Linux clients
96nomad_version_client_linux = [
97    "0.12.1",
98    "0.12.2"
99]
100```
101
102### ...Deploy Custom Configuration Files
103
104Set the `profile` field to `"custom"` and put the configuration files in
105`./terraform/config/custom/` as described in the
106[README](https://github.com/hashicorp/nomad/blob/main/e2e/terraform/README.md#Profiles).
107
108### ...Deploy More Than 4 Linux Clients
109
110Use the `"custom"` profile as described above.
111
112### ...Change the Nomad Version After Provisioning
113
114You can update the `nomad_version` variable, or simply rebuild the binary you
115have at the `nomad_local_binary` path so that Terraform picks up the
116changes. Then run `terraform plan`/`terraform apply` again. This will update
117Nomad in place, making the minimum amount of changes necessary.
118