diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index 0b0f024cf..f8d4032d3 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -17,6 +17,7 @@ import ( _ "github.com/hashicorp/nomad/e2e/deployment" _ "github.com/hashicorp/nomad/e2e/example" _ "github.com/hashicorp/nomad/e2e/hostvolumes" + _ "github.com/hashicorp/nomad/e2e/lifecycle" _ "github.com/hashicorp/nomad/e2e/metrics" _ "github.com/hashicorp/nomad/e2e/nomad09upgrade" _ "github.com/hashicorp/nomad/e2e/nomadexec" diff --git a/e2e/lifecycle/inputs/batch.nomad b/e2e/lifecycle/inputs/batch.nomad new file mode 100644 index 000000000..744bcf7b6 --- /dev/null +++ b/e2e/lifecycle/inputs/batch.nomad @@ -0,0 +1,127 @@ +# lifecycle hook test job for batch jobs. touches, removes, and tests +# for the existence of files to assert the order of running tasks. +# all tasks should exit 0 and the alloc dir should contain the following +# files: ./init-ran, ./main-ran, ./poststart-run + +job "batch-lifecycle" { + + datacenters = ["dc1"] + + type = "batch" + + group "test" { + + task "init" { + + lifecycle { + hook = "prestart" + } + + driver = "docker" + + config { + image = "busybox:1" + command = "/bin/sh" + args = ["local/prestart.sh"] + } + + template { + data = <