From c84b4ad67b0e758e77a367cc02bb3cc4bf2e0381 Mon Sep 17 00:00:00 2001 From: Daniel Bennett Date: Thu, 20 Jun 2024 11:18:53 -0500 Subject: [PATCH] e2e: add test for task schedule{} (#23382) --- e2e/task_schedule/input/schedule.nomad.hcl | 55 ++++ e2e/task_schedule/task_schedule_test.go | 295 +++++++++++++++++++++ 2 files changed, 350 insertions(+) create mode 100644 e2e/task_schedule/input/schedule.nomad.hcl create mode 100644 e2e/task_schedule/task_schedule_test.go diff --git a/e2e/task_schedule/input/schedule.nomad.hcl b/e2e/task_schedule/input/schedule.nomad.hcl new file mode 100644 index 00000000000..f240bb98bea --- /dev/null +++ b/e2e/task_schedule/input/schedule.nomad.hcl @@ -0,0 +1,55 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +variable "start" {} +variable "end" {} + +job "test_task_schedule" { + type = "service" + + group "group" { + # disable deployments + update { max_parallel = 0 } + # restart faster + restart { delay = "5s" } + + task "app" { + + # feature under test + schedule { + cron { + start = var.start + end = var.end + timezone = "UTC" # test "now"s are .UTC() + } + } + + driver = "raw_exec" + config { + command = "python3" + args = ["-c", local.app] + } + + } # task + } # group +} # job + +locals { + # this "app" just sleeps and handles signals to exit cleanly. + app = <