SkipIfNotPlatform skips the test if the running docker daemon is not running on a specific platform. platform should be in format os/arch (for example linux/arm64).
(t *testing.T, platform string)
| 102 | // SkipIfNotPlatform skips the test if the running docker daemon is not running on a specific platform. |
| 103 | // platform should be in format os/arch (for example linux/arm64). |
| 104 | func SkipIfNotPlatform(t *testing.T, platform string) { |
| 105 | t.Helper() |
| 106 | result := icmd.RunCmd(icmd.Command("docker", "version", "--format", "{{.Server.Os}}/{{.Server.Arch}}")) |
| 107 | result.Assert(t, icmd.Expected{Err: icmd.None}) |
| 108 | daemonPlatform := strings.TrimSpace(result.Stdout()) |
| 109 | skip.If(t, daemonPlatform != platform, "running against a non %s daemon", platform) |
| 110 | } |
| 111 | |
| 112 | // DaemonAPIVersion returns the negotiated daemon API version. |
| 113 | func DaemonAPIVersion(t *testing.T) string { |
nothing calls this directly
no test coverage detected
searching dependent graphs…