mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* fix panic from nil ReschedulePolicy
commit 279775082c (pr #26279)
intended to return an error for sysbatch jobs with a reschedule block,
but in bypassing populating the `ReschedulePolicy`'s pointer fields,
a nil pointer panic occurred before the job could get rejected
with the intended error.
in particular, in `command/agent/job_endpoint.go`, `func ApiTgToStructsTG`,
```
if taskGroup.ReschedulePolicy != nil {
tg.ReschedulePolicy = &structs.ReschedulePolicy{
Attempts: *taskGroup.ReschedulePolicy.Attempts,
Interval: *taskGroup.ReschedulePolicy.Interval,
```
`*taskGroup.ReschedulePolicy.Interval` was a nil pointer.
* fix e2e test jobs
e2e | v3
(!) These packages are experimental and breaking changes will be made. Also, expect bugs. Like a lot of bugs. Especially on non-happy paths.
The e2e/v3/ set of packages provide utilities for creating Nomad e2e tests in
a way that is convenient, reliable, and debuggable.
v3/cluster3- establish and verify the state of the clusterv3/jobs3- manage nomad jobs and wait for deployments, etc.v3/namespaces3- manage nomad namespacesv3/util3- helper methods specific to thev3utilities
Examples
simple
The simplest example, where we expect a cluster with a leader and at least one
Linux client in a ready state. The test case will submit the sleep.hcl job,
wait for the deployment to become succesfull (or fail / timeout), then cleanup
the job.
func TestExample(t *testing.T) {
cluster3.Establish(t,
cluster3.Leader(),
cluster3.LinuxClients(1),
)
t.Run("testSleep", testSleep)
}
func testSleep(t *testing.T) {
cleanup := jobs3.Submit(t, "./input/sleep.hcl")
t.Cleanup(cleanup)
}