talos/internal/pkg/rootfs/rootfs_test.go
Andrey Smirnov dc4865915d
refactor: stop using text/template in machined code paths
Reason: `text/template` uses reflect's MethodByName, disabling deadcode
linker phase.

Fixes #11299

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2025-08-07 19:22:23 +04:00

38 lines
987 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package rootfs_test
import (
"debug/buildinfo"
"os"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
"github.com/siderolabs/talos/pkg/machinery/constants"
)
func TestPkgsGoVersionMatchesTalos(t *testing.T) {
t.Parallel()
if hostname, _ := os.Hostname(); hostname != "buildkitsandbox" { //nolint:errcheck
t.Skipf("skipping test; only run on buildkitsandbox, got %s", hostname)
}
const sampleBinaryPath = "/usr/bin/containerd"
info, err := buildinfo.ReadFile(sampleBinaryPath)
if err != nil {
t.Fatalf("failed to read build info from %s: %v", sampleBinaryPath, err)
}
binaryGoVersion := info.GoVersion
runtimeGoVersion := runtime.Version()
assert.Equal(t, runtimeGoVersion, binaryGoVersion)
assert.Equal(t, runtimeGoVersion, constants.GoVersion)
}