76d8bfdff4
This field was added in f0e5b3d7d8
to
account for older versions of the engine (Docker EE LTS versions), which
did not yet provide the OSType field in Docker info, and had to be manually
set using the TEST_OSTYPE env-var.
This patch removes the field in favor of the equivalent in DaemonInfo. It's
more verbose, but also less ambiguous what information we're using (i.e.,
the platform the daemon is running on, not the local platform).
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package image
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/testutil/environment"
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
"gotest.tools/v3/skip"
|
|
)
|
|
|
|
// Regression test for: https://github.com/moby/moby/issues/45556
|
|
func TestImageInspectEmptyTagsAndDigests(t *testing.T) {
|
|
skip.If(t, testEnv.DaemonInfo.OSType == "windows", "build-empty-images is not called on Windows")
|
|
defer setupTest(t)()
|
|
|
|
client := testEnv.APIClient()
|
|
ctx := context.Background()
|
|
|
|
danglingId := environment.DanglingImageIdGraphDriver
|
|
if testEnv.UsingSnapshotter() {
|
|
danglingId = environment.DanglingImageIdSnapshotter
|
|
}
|
|
|
|
inspect, raw, err := client.ImageInspectWithRaw(ctx, danglingId)
|
|
assert.NilError(t, err)
|
|
|
|
// Must be a zero length array, not null.
|
|
assert.Check(t, is.Len(inspect.RepoTags, 0))
|
|
assert.Check(t, is.Len(inspect.RepoDigests, 0))
|
|
|
|
var rawJson map[string]interface{}
|
|
err = json.Unmarshal(raw, &rawJson)
|
|
assert.NilError(t, err)
|
|
|
|
// Check if the raw json is also an array, not null.
|
|
assert.Check(t, is.Len(rawJson["RepoTags"], 0))
|
|
assert.Check(t, is.Len(rawJson["RepoDigests"], 0))
|
|
}
|