Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of E2E: clarify drain -deadline and -force flag behaviors into release/1.3.x #16869

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
_ "github.com/hashicorp/nomad/e2e/metrics"
_ "github.com/hashicorp/nomad/e2e/namespaces"
_ "github.com/hashicorp/nomad/e2e/networking"
_ "github.com/hashicorp/nomad/e2e/nodedrain"
_ "github.com/hashicorp/nomad/e2e/nomadexec"
_ "github.com/hashicorp/nomad/e2e/oversubscription"
_ "github.com/hashicorp/nomad/e2e/parameterized"
Expand All @@ -42,6 +41,7 @@ import (
// these are no longer on the old framework but by importing them
// we get a quick check that they compile on every commit
_ "github.com/hashicorp/nomad/e2e/disconnectedclients"
_ "github.com/hashicorp/nomad/e2e/nodedrain"
_ "github.com/hashicorp/nomad/e2e/volumes"
)

Expand Down
4 changes: 4 additions & 0 deletions e2e/nodedrain/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package nodedrain

// 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
25 changes: 9 additions & 16 deletions e2e/nodedrain/input/drain_deadline.nomad
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
job "drain_deadline" {
datacenters = ["dc1", "dc2"]

constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}

migrate {
max_parallel = 1
min_healthy_time = "30s"
}

group "group" {

count = 2

task "task" {
driver = "docker"

kill_timeout = "2m"

config {
image = "busybox:1"
command = "/bin/sh"
args = ["local/script.sh"]
}

template {
data = <<EOF
#!/bin/sh
trap 'sleep 60' 2
sleep 600
EOF

destination = "local/script.sh"
change_mode = "noop"
args = ["-c", "sleep 600"]
}

resources {
cpu = 256
memory = 128
memory = 64
}
}
}
Expand Down
1 change: 0 additions & 1 deletion e2e/nodedrain/input/drain_ignore_system.nomad
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
job "drain_ignore_system_service" {
datacenters = ["dc1", "dc2"]

type = "system"

Expand Down
18 changes: 1 addition & 17 deletions e2e/nodedrain/input/drain_migrate.nomad
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
job "drain_migrate" {
datacenters = ["dc1", "dc2"]

constraint {
attribute = "${attr.kernel.name}"
Expand All @@ -19,22 +18,7 @@ job "drain_migrate" {
config {
image = "busybox:1"
command = "/bin/sh"
args = ["local/test.sh"]
}

template {
data = <<EOT
#!/bin/sh
if [ ! -f /alloc/data/{{ env "NOMAD_JOB_NAME" }} ]; then
echo writing {{ env "NOMAD_ALLOC_ID" }} to /alloc/data/{{ env "NOMAD_JOB_NAME" }}
echo {{ env "NOMAD_ALLOC_ID" }} > /alloc/data/{{ env "NOMAD_JOB_NAME" }}
else
echo /alloc/data/{{ env "NOMAD_JOB_NAME" }} already exists
fi
sleep 3600
EOT

destination = "local/test.sh"
args = ["-c", "echo \"data from $NOMAD_ALLOC_ID\" >> /alloc/data/migrate.txt && sleep 120"]
}

resources {
Expand Down
1 change: 0 additions & 1 deletion e2e/nodedrain/input/drain_simple.nomad
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
job "drain_simple" {
datacenters = ["dc1", "dc2"]

constraint {
attribute = "${attr.kernel.name}"
Expand Down
Loading