Skip to content

Commit

Permalink
Restore runc module version test
Browse files Browse the repository at this point in the history
The Kubernetes 1.31 bump reintroduced the transitive runc go dependency
again. Restore the module version check for it.

See: 537ebdb ("Bump containerd to v1.7.12")
Signed-off-by: Tom Wieczorek <[email protected]>
  • Loading branch information
twz123 committed Sep 10, 2024
1 parent 0909a40 commit 5d7b4b4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ updates:

# runc/containerd
- dependency-name: github.com/containerd/containerd
- dependency-name: github.com/opencontainers/runc

# sonobuoy
- dependency-name: github.com/vmware-tanzu/sonobuoy
Expand Down
24 changes: 24 additions & 0 deletions pkg/constant/constant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"runtime"
"slices"
"strings"
"testing"
Expand Down Expand Up @@ -128,6 +129,29 @@ func TestContainerdModuleVersions(t *testing.T) {
)
}

func TestRuncModuleVersions(t *testing.T) {
runcVersion := getVersion(t, "runc")

numMatched := checkPackageModules(t,
func(modulePath string) bool {
return modulePath == "github.com/opencontainers/runc"
},
func(t *testing.T, pkgPath string, module *packages.Module) bool {
return !assert.Equal(t, "v"+runcVersion, module.Version,
"Module version for package %s doesn't match: %+#v",
pkgPath, module,
)
},
)

if runtime.GOOS == "windows" {
// The runc dependency is only a thing on Linux.
assert.Zero(t, numMatched, "Expected no packages to to pass the filter on Windows.")
} else {
assert.NotZero(t, numMatched, "Not a single package passed the filter.")
}
}

func getVersion(t *testing.T, component string) string {
cmd := exec.Command("sh", "./vars.sh", component+"_version")
cmd.Dir = filepath.Join("..", "..")
Expand Down

0 comments on commit 5d7b4b4

Please sign in to comment.