mirror of https://github.com/hashicorp/boundary
Merge 4aa3c40afb into 96ba0e40e9
commit
7cdbac8fff
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
# Copyright IBM Corp. 2020, 2025
|
||||
# SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
chown 1000:1000 /etc/ssh/host-key
|
||||
chmod 400 /etc/ssh/host-key
|
||||
|
||||
if ! grep -qE '^HostKey[[:space:]]+/etc/ssh/host-key$' /config/sshd/sshd_config 2>/dev/null; then
|
||||
echo HostKey /etc/ssh/host-key >> /config/sshd/sshd_config
|
||||
fi
|
||||
|
||||
if ! grep -qE '^HostCertificate[[:space:]]+/etc/ssh/host-key-cert.pub$' /config/sshd/sshd_config 2>/dev/null; then
|
||||
echo HostCertificate /etc/ssh/host-key-cert.pub >> /config/sshd/sshd_config
|
||||
fi
|
||||
|
||||
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue