ce: Add infrastructure needed to test worker ssh known hosts (#6554)

(cherry picked from commit d022d7daf62623e5cca9c45cd234fd980d5baa9c)
This commit is contained in:
Michael Li authored and GitHub committed 2026-04-08 11:39:59 -04:00
1 parent cda43e9708
commit 1ba947d731
7 files changed
+174 -15

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
// Copyright IBM Corp. 2020, 2025
// SPDX-License-Identifier: BUSL-1.1
package boundary
import (
"context"
"encoding/json"
"testing"
gvers "github.com/hashicorp/go-version"
"github.com/stretchr/testify/require"
"github.com/hashicorp/boundary/testing/internal/e2e"
"github.com/hashicorp/boundary/version"
)
// IsVersionAtLeast checks if the Boundary version running in the specified container is at least the given minimum version.
func IsVersionAtLeast(t testing.TB, ctx context.Context, containerName string, minVersion string) {
output := e2e.RunCommand(
ctx,
"docker",
e2e.WithArgs(
"exec", containerName,
"boundary", "version",
"-format", "json",
),
)
require.NoError(t, output.Err, "failed to get version from container %q: %s", containerName, string(output.Stderr))
var versionResult version.Info
err := json.Unmarshal(output.Stdout, &versionResult)
require.NoError(t, err)
minSemVersion, err := gvers.NewSemver(minVersion)
require.NoError(t, err)
containerVersion := versionResult.Semver()
require.NotNil(t, containerVersion, "failed to parse version %q from container %q", versionResult.VersionNumber(), containerName)
if !containerVersion.GreaterThanOrEqual(minSemVersion) {
t.Skipf(
"Skipping test because container %q is running %q, but this test requires >= %q",
containerName,
versionResult.VersionNumber(),
minVersion,
)
}
}
+8
View File
@@ -35,6 +35,14 @@ type cassandraConfig struct {
NetworkAlias string
}
type DockerInspectResult []struct {
State struct {
Health *struct {
Status string `json:"Status"`
} `json:"Health"`
} `json:"State"`
}
// StartBoundaryDatabase spins up a postgres database in a docker container.
// Returns information about the container
func StartBoundaryDatabase(t testing.TB, pool *dockertest.Pool, network *dockertest.Network, repository, tag string) *Container {