Commit Graph

45 Commits

Author SHA1 Message Date
Michael Smithhisler
7867957811 e2e: remove legacy consul token tests (#25174) 2025-02-28 11:31:33 -05:00
Piotr Kazmierczak
543ba16e61 e2e: more retries for RequireConsulDeregistered (#19801) 2024-01-22 20:11:48 +01:00
Piotr Kazmierczak
8a4bd61caf e2e: WaitForJobStopped correction (#19749) 2024-01-22 11:38:22 +01:00
Piotr Kazmierczak
609f3a60b5 e2e: purging jobs removes all allocs (#19744)
There's no need to wait for allocs since #19609, in fact waiting for allocs to
stop will always fail leading to e2e failures.
2024-01-15 17:54:35 +01:00
hashicorp-copywrite[bot]
a9d61ea3fd Update copyright file headers to BUSL-1.1 2023-08-10 17:27:29 -05:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Charlie Voiselle
fe4ff5be2a Add option to expose workload token to task (#15755)
Add `identity` jobspec block to expose workload identity tokens to tasks.

---------

Co-authored-by: Anders <mail@anars.dk>
Co-authored-by: Tim Gross <tgross@hashicorp.com>
Co-authored-by: Michael Schurter <mschurter@hashicorp.com>
2023-02-02 10:59:14 -08:00
Seth Hoenig
3c17552d4d e2e: explicitly wait on task status in chroot download exec test (#15145)
Also add some debug log lines for this test, because it doesn't make sense
for the allocation to be complete yet a task in the allocation to be not
started yet, which is what the test failures are implying.
2022-11-04 09:50:11 -05:00
Michael Schurter
5ed74049e0 test: use port collision instead of cpu exhaustion (#14994)
Originally this test relied on Job 1 blocking Job 2 until Job 1 had a
terminal *ClientStatus.* Job 2 ensured it would get blocked using 2
mechanisms:

1. A constraint requiring it is placed on the same node as Job 1.
2. Job 2 would require all unreserved CPU on the node to ensure it would
   be blocked until Job 1's resources were free.

That 2nd assertion breaks if *any previous job is still running on the
target node!* That seems very likely to happen in the flaky world of our
e2e tests. In fact there may be some jobs we intentionally want running
throughout; in hindsight it was never safe to assume my test would be
the only thing scheduled when it ran.

*Ports to the rescue!* Reserving a static port means that both Job 2
will now block on Job 1 being terminal. It will only conflict with other
tests if those tests use that port *on every node.* I ensured no
existing tests were using the port I chose.

Other changes:
- Gave job a bit more breathing room resource-wise.
- Tightened timings a bit since previous failure ran into the `go test`
  time limit.
- Cleaned up the DumpEvals output. It's quite nice and handy now!
2022-10-21 07:53:26 -07:00
Michael Schurter
9cdbbbb583 test: extend timing and output of overlap e2e test (#14894)
Keeps failing in the nightly e2e test with unhelpful output like:
```
Failed
=== RUN   TestOverlap
    overlap_test.go:92: Followup job overlap93ee1d2b blocked. Sleeping for the rest of overlap48c26c39's shutdown_delay (9.2/10s)
    overlap_test.go:105: 1500/2000 retries reached for github.com/hashicorp/nomad/e2e/overlap.TestOverlap (err=timed out before an allocation was found for overlap93ee1d2b)
    overlap_test.go:105: timeout: timed out before an allocation was found for overlap93ee1d2b
--- FAIL: TestOverlap (38.96s)
```

I have not been able to replicate it in my own e2e cluster, so I added
the EvalDump helper to add detailed eval information like:

```
=== RUN   TestOverlap
1/1 Job overlap7b0e90ec Eval c38c9919-a4f0-5baf-45f7-0702383c682a
  Type:         service
  TriggeredBy:  job-register
  Deployment:
  Status:       pending ()
  NextEval:
  PrevEval:
  BlockedEval:
   -- No placement failures --
  QueuedAllocs:
  SnapshotIdx:  0
  CreateIndex:  96
  ModifyIndex:  96

...
```

Hopefully helpful when debugging other tests as well!
2022-10-14 14:15:07 -07:00
Piotr Kazmierczak
c4be2c6078 cleanup: replace TypeToPtr helper methods with pointer.Of (#14151)
Bumping compile time requirement to go 1.18 allows us to simplify our pointer helper methods.
2022-08-17 18:26:34 +02:00
Seth Hoenig
61ee443ee6 core: implement system batch scheduler
This PR implements a new "System Batch" scheduler type. Jobs can
make use of this new scheduler by setting their type to 'sysbatch'.

Like the name implies, sysbatch can be thought of as a hybrid between
system and batch jobs - it is for running short lived jobs intended to
run on every compatible node in the cluster.

As with batch jobs, sysbatch jobs can also be periodic and/or parameterized
dispatch jobs. A sysbatch job is considered complete when it has been run
on all compatible nodes until reaching a terminal state (success or failed
on retries).

Feasibility and preemption are governed the same as with system jobs. In
this PR, the update stanza is not yet supported. The update stanza is sill
limited in functionality for the underlying system scheduler, and is
not useful yet for sysbatch jobs. Further work in #4740 will improve
support for the update stanza and deployments.

Closes #2527
2021-08-03 10:30:47 -04:00
Seth Hoenig
6fdd06e760 e2e: add tests for consul namespaces from nomad oss
This PR adds a set of tests to the Consul test suite for testing
Nomad OSS's behavior around setting Consul Namespace on groups,
which is to ignore the setting (as Consul Namespaces are currently
an Enterprise feature).

Tests are generally a reduced facsimile of existing tests, modified
to check behavior of when group.consul.namespace is set and not set.
Verification is oriented around what happens in Consul; the in-depth
functional correctness of these features is left to the original tests.

Nomad ENT will get its own version of these tests in `namespaces_ent.go`.
2021-04-16 15:32:37 -06:00
Chris Baker
7f06adf1af Merge tag 'v1.0.3' into post-release-1.0.3
Version 1.0.3
2021-01-29 19:30:08 +00:00
Chris Baker
3eb9cdf740 additional e2e utils for multi-task allocs 2021-01-28 12:03:19 +00:00
Mahmood Ali
fe9929270c e2e: prefer testutil.WaitForResultRetries
Prefer testutil.WaitForResultRetries that emits more descriptive errors on
failures. `require.Evatually` fails with opaque "Condition never satisfied"
error message.
2021-01-26 10:01:14 -05:00
Seth Hoenig
74c1828431 e2e: use jobspec2 Parse for parsing jobfile in e2e utils
We directly parse job files in e2eutil, but currently using jobspec
package. Instead, use the Parse method from the jobspec2 package so
we can parse job files with new features.
2021-01-13 14:00:40 -06:00
Michael Schurter
7b648095d1 test: deflake consul e2e tests
Modernize test patterns by removing gomega and avoiding the mock_driver.
2020-08-19 14:29:22 -07:00
Seth Hoenig
fbd7f91165 e2e: add tests for connect native
Adds 2 tests around Connect Native. Both make use of the example connect native
services in https://github.com/hashicorp/nomad-connect-examples

One of them runs without Consul ACLs enabled, the other with.
2020-07-01 15:54:28 -05:00
Tim Gross
f858d4e141 e2e/csi: add waiting for alloc stop 2020-04-06 10:15:55 -04:00
Tim Gross
2468b3853c e2e: improve test reliability for CSI (#7616)
This changeset:

* adds eval status to the error messages emitted when we have
  placement failure in tests. The implementation here isn't quite
  perfect but it's a lot better than "condition not met".
* enforces the ordering of teardown of the CSI test
* doesn't pass the purge flag to one of the two CSI tests, so that we
  exercise both code paths.
2020-04-03 15:52:58 -04:00
Tim Gross
17ffbde52c e2e: remove gometa from e2eutils (#7610) 2020-04-03 10:22:22 -04:00
Drew Bailey
84cc906968 simplify job, better error 2020-02-04 13:59:39 -05:00
Drew Bailey
3609e3adc1 clean up 2020-02-04 11:59:28 -05:00
Drew Bailey
5c2075e463 get test passing, new util func to wait for not pending 2020-02-04 11:56:37 -05:00
Drew Bailey
756f5c7d79 add e2e test for system sched ineligible nodes 2020-02-04 11:56:33 -05:00
Seth Hoenig
9ccaa92ba1 e2e: remove leftover debug println statement 2020-02-03 11:15:38 -06:00
Seth Hoenig
04b526662c e2e: setup consul ACLs a little more correctly 2020-01-31 19:06:11 -06:00
Tim Gross
31f91cf4c8 e2e: fixes for race conditions in testing (#6300)
- In script checks, ensure we're running `Exec` against the new running
  allocation and not the earlier stopped one.
- In script checks, allow `Exec` calls to error due to lack of pty when
  we use the exec to kill the task.
- In `utils.go/RegisterAllocs`, force query for allocations to wait on
  wait index returned by registration call.
2019-09-10 13:45:16 -04:00
Lang Martin
4b8c9428f4 e2e/deployment DeploymentsForJob fail instead of nil, error passing 2019-06-04 14:31:42 -04:00
Lang Martin
22b6c2e6ad e2e/deployment find the second deployment, use its status 2019-06-04 13:41:52 -04:00
Lang Martin
dd2f16a031 e2e add deployment to the list of e2e tests, minor fixes 2019-05-22 12:34:57 -04:00
Lang Martin
3a3c4426bb e2e utils remove ineffectual assignment of allocs 2019-05-22 12:34:57 -04:00
Lang Martin
1a99a0f771 e2e utils error format arg match 2019-05-22 12:32:08 -04:00
Lang Martin
8b64574721 e2e util split new alloc and await placement, new WaitForDeployment 2019-05-22 12:32:08 -04:00
Michael Schurter
91d36f9f6a e2e: add NomadAgent and basic client state test
The e2e test code is absolutely hideous and leaks processes and files
on disk. NomadAgent seems useful, but the clientstate e2e tests are very
messy and slow. The last test "Corrupt" is probably the most useful as
it explicitly corrupts the state file whereas the other tests attempt to
reproduce steps thought to cause corruption in earlier releases of
Nomad.
2019-03-21 07:14:34 -07:00
Michael Schurter
35eff08386 Apply suggestions from code review
Co-Authored-By: nickethier <ncethier@gmail.com>
2019-01-23 14:09:49 -05:00
Nick Ethier
6191fe3f2c e2e: add tests for nomad driver upgrade path 2019-01-17 23:32:45 -05:00
Michael Schurter
c9dc5e4999 e2e: wait for at least N nodes to be ready
Before it was *exactly* N nodes which limited test portability between
clusters.
2019-01-08 14:39:37 -08:00
Mahmood Ali
bce7c9372d goimport file 2019-01-04 08:53:50 -05:00
Preetha Appan
21810d0edd Added waiting on client node ready state before running e2e tests 2019-01-03 16:16:20 -06:00
Preetha Appan
36b5435ed3 Increase alloc wait timeout in e2e test 2019-01-03 14:02:02 -06:00
Preetha Appan
1cfef83302 Increase timeout in e2e test 2019-01-03 11:22:21 -06:00
Danielle Tomlinson
002f19085a e2e: goimports e2eutil/utils.go 2019-01-03 13:31:49 +01:00
Preetha Appan
7ad040166d new e2e test for spread, and refactor affinity tests to share util methods 2018-12-19 21:25:32 -06:00