Commit Graph

810 Commits

Author SHA1 Message Date
Tim Gross
7bfc04576a E2E: disable sdnotify for Consul agents (#26078)
In our E2E environment we've seen some flakiness with the Consul-related
tests. As it turns out, the Consul agents are getting restarted every 90s or so
because they're timing out their systemd notification.

> consul.service: start operation timed out. Terminating.

This appears to be a known issue in Consul and we'll try to contribute some help
to hunt down the cause if they want help, but in the meantime let's remove it
from our systemd unit files for the Consul agents.

Ref: https://github.com/hashicorp/consul/issues/16844#issuecomment-1913282248
2025-06-18 17:03:32 -04:00
Tim Gross
976ea854b0 E2E: fix scaling test assertion for extra Windows host (#26077)
* E2E: fix scaling test assertion for extra Windows host

The scaling test assumes that all nodes will receive the system job. But the job
can only run on Linux hosts, so the count will be wrong if we're running a
Windows host as part of the cluster. Filter the expected count by the OS.

While we're touching this test, let's also migrate it off the legacy framework.

* address comments from code review
2025-06-18 17:03:17 -04:00
Tim Gross
3c67ba0516 E2E: update TaskAPI test for Windows (#26074)
The current version of Windows we're using ships with curl, so we don't need to
download it as an artifact anymore. Remove the broken reference to this in the TaskAPI
test for Windows.

Ref: https://github.com/hashicorp/nomad-e2e/actions/runs/15708894856/job/44267973319
2025-06-17 16:03:50 -04:00
Tim Gross
d6800c41c1 E2E: include Windows 2022 host in test targets (#26003)
Some time ago the Windows host we were using as a Nomad client agent test target
started failing to allow ssh connections. The underlying problem appears to be
with sysprep but I wasn't able to debug the exact cause as it's not an area I
have a lot of expertise in.

Swap out the deprecated Windows 2016 host for a Windows 2022 host. This will use
a base image provided by Amazon and then we'll use a userdata script to
bootstrap ssh and some target directories for Terraform to upload files to. The
more modern Windows will let us drop some of extra powershell scripts we were
using as well.

Fixes: https://hashicorp.atlassian.net/browse/NMD-151
Fixes: https://github.com/hashicorp/nomad-e2e/issues/125
2025-06-16 12:12:15 -04:00
Daniel Bennett
7519df8d06 task env: add NOMAD_UNIX_ADDR var (#25598)
for easier setup when using workload identity + task api
2025-06-11 15:56:51 -04:00
Piotr Kazmierczak
348177d118 e2e: correct TestSingleAffinities behavior (#25943)
TestSingleAffinities never expected a node with affinity score set to 0 in
the set of returned nodes. However, since #25800, this can happen. What the
test should be checking for instead is that the node with the highest normalized
score has the right affinity.
2025-05-30 19:46:08 +02:00
Michael Smithhisler
4c8257d0c7 client: add once mode to template block (#25922) 2025-05-28 11:45:11 -04:00
Piotr Kazmierczak
a10c2f6de7 e2e: mention in the terraform readme that we require a local Consul binary (#25944) 2025-05-28 17:12:57 +02:00
Tim Gross
0e728b87db E2E: remove dnsmasq and references to ECS plugin (#25892)
The DNS configuration for our E2E cluster uses dnsmasq to pass all DNS through
Consul. But there's a circular reference in systemd configurations that
sometimes causes the Docker service to fail, this is causing test flakes during
upgrade testing because we count the number of nodes and expect `system` jobs
using Docker to run on all nodes.

We no longer have any tests that require Consul DNS, so remove the complication
of dnsmasq to break the reference cycle. Also, while I was looking at this I
noticed we still had setup that would configure the ECS remote task driver
plugin, which is archived. Remove this as well.

Ref: https://hashicorp.atlassian.net/browse/NMD-162
2025-05-20 08:26:22 -04:00
James Rasell
4b40e10e68 e2e: Update UI playwright version to 1.52.0 (#25740) 2025-04-24 13:38:26 +01:00
James Rasell
717207bce0 e2e: Fix TestDocker/testRedis with increased timeout on deployment (#25739)
The fresh deployment of the Redis job took around 20s which is
also the default context timeout on the e2e util that monitors and
waits for a deployment to complete.

The tight timing meant the test often timed out but sometimes
would complete successfully. Increasing the timeout for this
deployment will remove the flakiness.
2025-04-24 09:09:33 +01:00
Tim Gross
88dc842729 testing: use Docker Hub registry mirror for CI (#25703)
As of April 1, Docker Hub rate limits tightened. With only 10 pulls/hr/IP, we're
likely to encounter test failures. Switch all Docker images getting pulled from
this repository to use the HashiCorp managed registry mirror.

Note that most of our tests in `drivers/docker` don't pull from the remote
registry but load a local image, while others will need to pull from the remote
and fetch different images depending on OS/arch. Refactor the definition of test
task configuration to make it clear which is which, and de-factor some false
sharing of setup functions.

Updates the E2E tests to use that registry by configuring the Docker
daemon. This required changing out a few container images that we don't have in
the registry, but these new images are all smaller. There are a couple of tests
that still use explicitly-tagged `docker.io` images or other third-party
registries, which have been left in place.

Ref: https://hashicorp.atlassian.net/browse/NET-12233

update E2E images to those in the registry mirror

fix windows and docklog test build

fix stopsignal test

mop-up

more mop-up
2025-04-18 14:21:49 -04:00
James Rasell
311a83d706 e2e: Ensure UI is enabled. (#25620)
The `ui.enabled` parameter is a non-pointer bool which means the
merge function is unable to differentiate between false and not
set. When e2e introduced the `ui.show_cli_hints` configuration
parameter, the way we merge meant the UI became disabled.
2025-04-08 13:57:29 +01:00
James Rasell
6c39285538 e2e: Ensure test resources are cleaned. (#25611)
I couldn't find any reason the exec2 HTTP jobs were not being run
with a generated cleanup function, so I added this.

The deletion of the DHV ACL policy does not seem like it would
have any negative impact.
2025-04-07 14:15:29 +01:00
Phil Renaud
afa9e65afa Update playwright to 1.51.0 for e2e ui tests (#25585) 2025-04-02 15:12:00 +01:00
Michael Smithhisler
c8cc519f54 e2e: disable cli hints for command parsing (#25584) 2025-04-02 09:12:36 -04:00
Michael Smithhisler
95c9029df0 e2e: update consul task policy and add empty consul block to task groups (#25580) 2025-04-01 16:29:47 -04:00
Michael Smithhisler
077c1921ef e2e: disable IMDSv2 in tests (#25564)
Consul needs to use a newer version of go-discover that can query IMDSv2
in order for our test infrastructure to be enabled with it.
2025-03-31 12:07:45 -04:00
Michael Smithhisler
8e3625a716 e2e: create consul policies and roles in respective namespaces (#25546) 2025-03-28 13:52:49 -04:00
Piotr Kazmierczak
a1fd9da705 e2e: require IMDSv2 for ec2 instances (#25541)
Require Instance Metadata Service v2 to access EC2 instance metadata for all VMs
that run our e2e suite.
2025-03-28 09:58:51 +01:00
Michael Smithhisler
f0e0215d56 e2e: fix consul e2e enterprise logic in bootstrapping (#25532) 2025-03-26 14:08:20 -04:00
Michael Smithhisler
c66269f8d0 e2e: fixes node write policy for consul agents (#25418) 2025-03-17 15:18:30 -04:00
Juana De La Cuesta
9b9d16421e Merge branch 'main' into NET-11546-enos-drain 2025-03-17 16:14:18 +01:00
Juanadelacuesta
4b0903789e func: add check script for vault workload 2025-03-14 17:03:35 +01:00
Juanadelacuesta
3af2da7362 fix: add default policy to consul acl configurations for the e2e cluster 2025-03-14 16:46:03 +01:00
Juanadelacuesta
4c1ba45d48 func: add workload to test vault workload identity 2025-03-13 17:55:59 +01:00
Tim Gross
5cc1b4e606 upgrade tests: add transparent proxy workload (#25176)
Add an upgrade test workload for Consul service mesh with transparent
proxy. Note this breaks from the "countdash" demo. The dashboard application
only can verify the backend is up by making a websocket connection, which we
can't do as a health check, and the health check it exposes for that purpose
only passes once the websocket connection has been made. So replace the
dashboard with a minimal nginx reverse proxy to the count-api instead.

Ref: https://hashicorp.atlassian.net/browse/NET-12217
2025-03-07 15:25:26 -05:00
Tim Gross
c3e2d4a652 E2E: remove outdated legacy token workflow tests (#25315)
In https://github.com/hashicorp/nomad/pull/25217 we removed the legacy Consul token workflow, and in https://github.com/hashicorp/nomad/pull/25174 we removed the related E2E tests. But we missed the tests in the `e2e/connect` package.

After removing these tests, Consul-related E2E tests in this repo pass.
2025-03-07 15:09:36 -05:00
Michael Smithhisler
5c4d0e923d consul: Remove legacy token based authentication workflow (#25217) 2025-03-05 15:38:11 -05:00
Tim Gross
916fe2c7fa upgrade testing: rework CSI test to use self-contained workload (#25285)
Getting the CSI test to work with AWS EFS or EBS has proven to be awkward
because we're having to deal with external APIs with their own consistency
guarantees, as well as challenges around teardown. Make the CSI test entirely
self-contained by using a userland NFS server and the rocketduck CSI plugin.

Ref: https://hashicorp.atlassian.net/browse/NET-12217
Ref: https://gitlab.com/rocketduck/csi-plugin-nfs
2025-03-05 11:48:19 -05:00
Michael Smithhisler
25cea5c16b e2e: allow consul access to nomad cluster (#25277) 2025-03-04 09:06:50 -05:00
Michael Smithhisler
7867957811 e2e: remove legacy consul token tests (#25174) 2025-02-28 11:31:33 -05:00
Tim Gross
3b9290a11e E2E: fix column parsing for dynamic host volumes test (#25228)
In #25185 we changed the output of `volume status` to include both DHV and CSI
volumes by default. When the E2E test parses the output, it's not expecting the
new section header.

Ref: https://github.com/hashicorp/nomad/pull/25185
2025-02-26 09:52:47 -05:00
James Rasell
8bce0b0954 e2e: Migrate legacy Vault token based workflow to workload ID (#25139)
Nomad 1.10.0 is removing the legacy Vault token based workflow
which means the legacy e2e compatibility tests will fail and not
work.

The Nomad e2e cluster was using the legacy Vault token based
workflow for initial cluster build. This change migrates to using
the workload identity flow which utilizes authentication methods,
roles, and policies.

The Nomad server network has been modified to allow traffic from
the HCP Vault HVN which is a private network peered into our AWS
account. This is required, so that Vault can pull JWKS
information from the Nomad API without going over the public
internet.

The cluster build will now also configure a Vault KV v2 mount at
a unique indentifier for the e2e cluster. This allows all Nomad
workloads and tests to use this if required.

The vaultsecrets suite has been updated to accommodate the new
changes and extended to test the default workload ID flow for
allocations which use Vault for secrets.
2025-02-20 14:06:25 +00:00
Tim Gross
86e1d6da52 E2E: use repo root to find correct git sha for AMI (#25151)
The nightly E2E run only builds a new AMI when required by changes to the
build. The AMI is tagged with the SHA of the commit that forced that build,
which may not be the commit that's spawning a particular test run. So we have a
resource in the `provision-infra` module that finds that SHA.

But when we run upgrade testing via Enos, we're running the E2E Terraform
configuration from outside the `e2e/terraform` folder. So the script that
resource runs will fail and prevent us from getting the AMI. Fix the script so
it can be run from any folder.

We also have duplicate resources for the "ubuntu jammy" AMI, but this is because
the Enos matrix might (in the near future) test with ARM64. For now, we'll pin
the Consul server to AMD64. Rename the resource appropriately to make the source
of the duplicate obvious.
2025-02-19 08:59:22 -05:00
Juana De La Cuesta
af2ac87409 Simplify binary overrides on e2e provision (#25122)
* func: remove the lists to override the nomad_local_binary for servers and clients

* docs: add a note to the terraform e2e readme

* fix: remove the extra 'windows' from the aws_ami filter

* style: hcl fmt
2025-02-17 16:13:32 +01:00
Daniel Bennett
92c90af542 e2e: task schedule: pauses vs restarts (#25085)
CE side of ENT PR:
task schedule: pauses are not restart "attempts"

distinguish between these two cases:
1. task dies because we "paused" it (on purpose)
   - should not count against restarts,
     because nothing is wrong.
2. task dies because it didn't work right
   - should count against restart attempts,
     so users can address application issues.

with this, the restart{} block is back to its normal
behavior, so its documentation applies without caveat.
2025-02-11 09:46:58 -06:00
Juana De La Cuesta
cfc24116b3 Add tag to instances with OS and add merged output (#25071)
* func: add a new output that merges both windowa and linux clients, but add tags to distinguish them

* fix: outputs cant referrence other outputs in terraform

* Update e2e/terraform/provision-infra/compute.tf

Co-authored-by: Tim Gross <tgross@hashicorp.com>

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2025-02-10 17:08:07 +01:00
Tim Gross
a11325863e E2E: dynamic host volumes (#25063)
I merged #24869 having forgotten we don't run these tests in PR CI, so there's a compile error in the test. Fix that error and add the no-op import we use to catch this kind of thing.

Ref: https://github.com/hashicorp/nomad/pull/24869
2025-02-07 16:27:36 -05:00
Tim Gross
3f2d4000a6 E2E: dynamic host volume tests for sticky volumes (#24869)
Add tests for dynamic host volumes where the claiming jobs have `volume.sticky =
true`. Includes a test for forced rescheduling and a test for node drain.

This changeset includes a new `e2e/v3`-style package for creating dynamic host
volumes, so we can reuse that across other tests.
2025-02-07 15:50:54 -05:00
Juana De La Cuesta
d53b8a7e98 func: remove triggers from resources that copy the binaries into the remote instances (#25036) 2025-02-06 17:11:19 +01:00
Juana De La Cuesta
3861c40220 func: add initial enos skeleton (#24787)
* func: add initial enos skeleton

* style: add headers

* func: change the variables input to a map of objects to simplify the workloads creation

* style: formating

* Add tests for servers and clients

* style: separate the tests in diferent scripts

* style: add missing headers

* func: add tests for allocs

* style: improve output

* func: add step to copy remote upgrade version

* style: hcl formatting

* fix: remove the terraform nomad provider

* fix: Add clean token to remove extra new line added in provision

* fix: Add clean token to remove extra new line added in provision

* fix: Add clean token to remove extra new line added in provision

* fix: add missing license headers

* style: hcl fmt

* style: rename variables and fix format

* func: remove the template step on the workloads module and chop the noamd token output on the provide module

* fix: correct the jobspec path on the workloads module

* fix: add missing variable definitions on job specs for workloads

* style: formatting

* fix: rename variable in health test
2025-01-30 16:37:55 +01:00
Michael Smithhisler
47c14ddf28 remove remote task execution code (#24909) 2025-01-29 08:08:34 -05:00
Juana De La Cuesta
1b1ad896ec Add the path to the ssh key to connect to the cluster's instances as an output (#24969)
* fix: add the ssh key pem path to te outputs and fix the message with the correct path

* func: add ssh pem key as output
2025-01-28 18:25:02 +01:00
James Rasell
c8d7e741c8 e2e: Fix TF output SSH key path. (#24965) 2025-01-28 16:29:56 +00:00
James Rasell
8859cfa3f5 e2e: Ensure Consul client is running before starting Nomad service. (#24964) 2025-01-28 15:28:12 +00:00
Phil Renaud
7106ac1462 Update playwright to 1.50.0 for e2e ui tests (#24956) 2025-01-27 12:03:59 -05:00
Juana De La Cuesta
687335639b fix: add a dependency to avoid terraform errors when generating ssh keys (#24912) 2025-01-22 11:36:03 +01:00
Juana De La Cuesta
039da61d8f [F-net-11478] Make keys directory cluster grouped (#24883)
* func: make windows arch dependant

* func: unify keys and make them cluster grouped

* Update README.md

* Update e2e/terraform/provision-infra/provision-nomad/variables.tf

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* Update .gitignore

* style: add an output with the custer identifier

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2025-01-20 10:18:38 +01:00
Tim Gross
1df94b1470 E2E: refactor volume_mounts test (#24876)
The volume_mounts test is flaky due to slow starts from the exec-driver and some
incorrect wait code. Refactor the volume_mounts test to use the `e2e/v3` package
helpers, and use these to give it enough time to start the exec tasks.
2025-01-17 08:31:50 -05:00