Skip to content

Commit

Permalink
e2e: fix and modernize rescheduling test (hashicorp#19105)
Browse files Browse the repository at this point in the history
The E2E test suite for rescheduling had a few bugs:
* Using the command line to stop a job with a failing deployment returns a non-zero exit
  code, which would cause an otherwise passing test to fail.
* Two of the input jobs were actually invalid but were only correctly detected
  as such because of hashicorp#17342

This changeset also updates the whole test suite to move it off the v1
"framework". A few test assertions are also de-flaked.

Fixes: hashicorp#19076
  • Loading branch information
tgross authored and nvanthao committed Mar 1, 2024
1 parent 20a98f5 commit 0da8ff0
Show file tree
Hide file tree
Showing 10 changed files with 525 additions and 508 deletions.
2 changes: 1 addition & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
_ "github.com/hashicorp/nomad/e2e/podman"
_ "github.com/hashicorp/nomad/e2e/quotas"
_ "github.com/hashicorp/nomad/e2e/remotetasks"
_ "github.com/hashicorp/nomad/e2e/rescheduling"
_ "github.com/hashicorp/nomad/e2e/scaling"
_ "github.com/hashicorp/nomad/e2e/scalingpolicies"
_ "github.com/hashicorp/nomad/e2e/scheduler_sysbatch"
Expand All @@ -45,6 +44,7 @@ import (
_ "github.com/hashicorp/nomad/e2e/disconnectedclients"
_ "github.com/hashicorp/nomad/e2e/namespaces"
_ "github.com/hashicorp/nomad/e2e/nodedrain"
_ "github.com/hashicorp/nomad/e2e/rescheduling"
_ "github.com/hashicorp/nomad/e2e/volumes"
)

Expand Down
7 changes: 7 additions & 0 deletions e2e/rescheduling/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package rescheduling

// This package contains only tests, so this is a placeholder file to
// make sure builds don't fail with "no non-test Go files in" errors
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ job "test" {
min_healthy_time = "1s"
auto_revert = true
healthy_deadline = "2s"
progress_deadline = "3s"
progress_deadline = "5s"
}

restart {
Expand Down
2 changes: 1 addition & 1 deletion e2e/rescheduling/input/rescheduling_maxp_autorevert.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ job "demo3" {
min_healthy_time = "1s"
auto_revert = true
healthy_deadline = "2s"
progress_deadline = "3s"
progress_deadline = "5s"
}

restart {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ job "demo2" {
update {
# we want the first allocation to take a while before we give up on it,
# so that we can check the deployment's progress deadline before and
# after it becomes healthy
# after we determine it will never become healthy
min_healthy_time = "10s"
healthy_deadline = "15s"
progress_deadline = "20s"
Expand All @@ -42,7 +42,7 @@ job "demo2" {
}

reschedule {
unlimited = "true"
unlimited = true
delay_function = "constant"
delay = "5s"
}
Expand Down
7 changes: 4 additions & 3 deletions e2e/rescheduling/input/rescheduling_success.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ job "test3" {
}

reschedule {
attempts = 2
interval = "5m"
unlimited = false
delay = "5s"
delay_function = "constant"
unlimited = true
}

}
}
Loading

0 comments on commit 0da8ff0

Please sign in to comment.