Files
nomad/e2e/consulcompat/consulcompat_test.go
Tim Gross 6c2d5a0fbb E2E: Consul compatibility matrix tests (#18799)
Set up a new test suite that exercises Nomad's compatibility with Consul. This
suite installs all currently supported versions of Consul, spins up a Consul
agent with appropriate configuration, and a Nomad agent running in dev
mode. Then it runs a Connect job against each pair.
2023-10-24 16:03:53 -04:00

44 lines
895 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package consulcompat
import (
"os"
"syscall"
"testing"
"github.com/hashicorp/nomad/client/testutil"
)
const (
envTempDir = "NOMAD_E2E_CONSULCOMPAT_BASEDIR"
envGate = "NOMAD_E2E_CONSULCOMPAT"
)
func TestConsulCompat(t *testing.T) {
if os.Getenv(envGate) != "1" {
t.Skip(envGate + " is not set; skipping")
}
if syscall.Geteuid() != 0 {
t.Skip("must be run as root so that clients can run Docker tasks")
}
testutil.RequireLinux(t)
t.Run("testConsulVersions", func(t *testing.T) {
baseDir := os.Getenv(envTempDir)
if baseDir == "" {
baseDir = t.TempDir()
}
versions := scanConsulVersions(t, getMinimumVersion(t))
versions.ForEach(func(b build) bool {
downloadConsulBuild(t, b, baseDir)
testConsulBuildLegacy(t, b, baseDir)
testConsulBuild(t, b, baseDir)
return true
})
})
}