1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: add utility to check if snapshotters are enabled

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-08-22 19:53:07 +02:00
parent 500c026818
commit 74b84d00b3
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 13 additions and 2 deletions

View file

@ -42,8 +42,7 @@ func (s *DockerCLIInspectSuite) TestInspectImage(c *testing.T) {
// fails, fix the difference in the image serialization instead of
// updating this hash.
imageTestID := "sha256:11f64303f0f7ffdc71f001788132bca5346831939a956e3e975c93267d89a16d"
usesContainerdSnapshotter := false // TODO(vvoland): Check for feature flag
if usesContainerdSnapshotter {
if containerdSnapshotterEnabled() {
// Under containerd ID of the image is the digest of the manifest list.
imageTestID = "sha256:e43ca824363c5c56016f6ede3a9035afe0e9bd43333215e0b0bde6193969725d"
}

View file

@ -10,6 +10,7 @@ import (
"testing"
"time"
"github.com/containerd/containerd/plugin"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/versions"
@ -99,6 +100,17 @@ func Devicemapper() bool {
return strings.HasPrefix(testEnv.DaemonInfo.Driver, "devicemapper")
}
// containerdSnapshotterEnabled checks if the daemon in the test-environment is
// configured with containerd-snapshotters enabled.
func containerdSnapshotterEnabled() bool {
for _, v := range testEnv.DaemonInfo.DriverStatus {
if v[0] == "driver-type" {
return v[1] == string(plugin.SnapshotPlugin)
}
}
return false
}
func IPv6() bool {
cmd := exec.Command("test", "-f", "/proc/net/if_inet6")
return cmd.Run() != nil