https://github.com/schmichael/nomad-dispatch-repro
testing repo for nomad dispatching code
https://github.com/schmichael/nomad-dispatch-repro
Last synced: about 2 months ago
JSON representation
testing repo for nomad dispatching code
- Host: GitHub
- URL: https://github.com/schmichael/nomad-dispatch-repro
- Owner: schmichael
- License: mpl-2.0
- Created: 2024-11-14T23:46:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-15T01:31:47.000Z (over 1 year ago)
- Last Synced: 2025-03-12T14:26:22.776Z (about 1 year ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nomad dispatch job tester
Following dispatch jobs is harder than it ought to be. This is a test repro
based on real code to demonstrate how difficult it is to get right.
This code will register a parameterized job and then dispatch many instances of
it: attempting to follow each dispatch to its completion.
## prerequisites
1. A running Nomad cluster (can be `nomad agent -dev`)
2. `NOMAD_ADDR`, `NOMAD_TOKEN`, and any other env vars necessary to register
jobs set.
3. Go
## running
```
# If you have the source checked out:
$ go run .
2024/11/14 15:56:06 [ 0:0 ] ok
2024/11/14 15:56:06 [ 0:0 ] ok
2024/11/14 15:56:06 [ 0:0 ] ok
2024/11/14 15:56:06 [ 1:0 ] ok
2024/11/14 15:56:06 [ 1:0 ] expected "sleeper" task but none is found for dispatch ID sleeper/dispatch-1731628560-bbbe6f03
... snip ...
2024/11/14 15:57:12 [ 2:9 ] ok
2024/11/14 15:57:12 [ 2:9 ] ok
2024/11/14 15:57:12 500 done after 1m12.399s with 53 errors
```
For certain errors the allocation(s) in question will be written to the current
directory as json such as: `feb895ce-2aaa-8460-c754-cf05a8127370.alloc.json`
Use `-help` to see and adjust test parameters.
The test does *not* cleanup after itself, but only creates 1 job (and a number
of dead allocs).
## example output
With no errors as of 215630b2a785114d77bb648f24a17ee5bd0b1a64:
```
2024/11/14 16:09:00 500 done after 1m9.374s with 0 errors
```