mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
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.
44 lines
895 B
Go
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
|
|
})
|
|
})
|
|
}
|