From 7ea45f8d0c1cb21f9b2d3d1676c0ba0037b0887e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corn=C3=A9=20Lukken?= <lukken@astron.nl> Date: Mon, 4 Nov 2024 14:06:33 +0000 Subject: [PATCH] L2SS-2032: Fix integration tests after jumppad consul removal --- README.md | 1 + infra/dev/nomad/config/nomad/client.hcl | 5 +++-- infra/dev/nomad/nomad.hcl | 18 +++++++++++++----- infra/jobs/station/tango.levant.nomad | 9 +++++++-- setup.sh | 2 +- tangostationcontrol/VERSION | 2 +- .../test/change-events/__init__.py | 0 .../test/change-events/test_sync_sync.py | 0 8 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 tangostationcontrol/test/change-events/__init__.py create mode 100644 tangostationcontrol/test/change-events/test_sync_sync.py diff --git a/README.md b/README.md index 0524b6992..efb887f13 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Next change the version in the following places: # Release Notes +* 0.43.2 Fix jumppad integration test using custom nomad image that includes consul * 0.43.1 Fix rounding for the coarse delay and loss compensations. * 0.43.0 Use PyTango 10.0.0 * 0.42.12 Calibration device now fetches the station's name from the StationManager diff --git a/infra/dev/nomad/config/nomad/client.hcl b/infra/dev/nomad/config/nomad/client.hcl index ad35cb851..9bc5e3d35 100644 --- a/infra/dev/nomad/config/nomad/client.hcl +++ b/infra/dev/nomad/config/nomad/client.hcl @@ -77,7 +77,9 @@ telemetry { } consul { - address = "localhost:8500" + # address = "192.168.76.2:8500" + # checks_use_advertise = true # Otherwise will fallback to bind_addr + addres = "127.0.0.1:8500" server_service_name = "nomad" client_service_name = "nomad-client" auto_advertise = true @@ -86,7 +88,6 @@ consul { } advertise { - http = "{{ GetInterfaceIP \"eth0\" }}" rpc = "{{ GetInterfaceIP \"eth0\" }}" serf = "{{ GetInterfaceIP \"eth0\" }}" diff --git a/infra/dev/nomad/nomad.hcl b/infra/dev/nomad/nomad.hcl index 45035bfee..eab54d784 100644 --- a/infra/dev/nomad/nomad.hcl +++ b/infra/dev/nomad/nomad.hcl @@ -1,6 +1,7 @@ resource "network" "station" { subnet = "192.168.72.0/21" } + resource "template" "consul_config" { source = <<-EOF @@ -39,9 +40,10 @@ resource "template" "consul_config" { destination = "./tmp/consul.hcl" } - resource "container" "consul" { - depends_on = ["resource.template.consul_config"] + depends_on = [ + "resource.template.consul_config", "resource.network.station" + ] network { id = resource.network.station.meta.id ip_address = "192.168.76.1" @@ -54,6 +56,7 @@ resource "container" "consul" { command = [ "consul", "agent", + "-dev", "-config-file=/consul/config/config.hcl" ] @@ -82,17 +85,22 @@ resource "container" "consul" { privileged = false } - resource "nomad_cluster" "station" { - depends_on = ["resource.container.consul"] + depends_on = [ + "resource.container.consul", + ] client_nodes = 1 client_config = "./config/nomad/client.hcl" consul_config = "./config/nomad/consul.hcl" datacenter = "stat" + image { + name = "git.astron.nl:5000/lofar2.0/jumppad-docker-files/nomad:latest" + } + network { id = resource.network.station.meta.id - #ip_address = "192.168.76.250" + # ip_address = "192.168.76.3" } environment = { NO_PROXY = "astron.nl,control.lofar,10.0.0.0/8" diff --git a/infra/jobs/station/tango.levant.nomad b/infra/jobs/station/tango.levant.nomad index 3b2f012c5..bb132133e 100644 --- a/infra/jobs/station/tango.levant.nomad +++ b/infra/jobs/station/tango.levant.nomad @@ -104,11 +104,16 @@ job "tango" { } template { + wait { + min = "30s" + max = "300s" + } + error_on_missing_key = true data = <<EOH -{{ range service "tangodb" }} +{{- range service "tangodb" }} MYSQL_HOST = "{{ .Address }}" MYSQL_PORT = "{{ .Port }}" -{{ end }} +{{- end }} EOH destination = "local/env.txt" env = true diff --git a/setup.sh b/setup.sh index 6fad1cbc5..9b78cf467 100755 --- a/setup.sh +++ b/setup.sh @@ -43,7 +43,7 @@ if dig @127.0.0.1 -p 8600 tango.service.consul +short > /dev/null; then TANGO_HOST=$(dig @127.0.0.1 -p 8600 tango.service.consul +short) export TANGO_HOST="$TANGO_HOST:$TANGO_PORT" else - export TANGO_HOST=$(hostname):10000 + export TANGO_HOST="$(hostname):10000" fi echo "Using tango host $TANGO_HOST" diff --git a/tangostationcontrol/VERSION b/tangostationcontrol/VERSION index f8287cf95..fda7553d4 100644 --- a/tangostationcontrol/VERSION +++ b/tangostationcontrol/VERSION @@ -1 +1 @@ -0.43.1 +0.43.2 diff --git a/tangostationcontrol/test/change-events/__init__.py b/tangostationcontrol/test/change-events/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tangostationcontrol/test/change-events/test_sync_sync.py b/tangostationcontrol/test/change-events/test_sync_sync.py new file mode 100644 index 000000000..e69de29bb -- GitLab