MCPcopy Create free account
hub / github.com/containers/common / TestImport

Function TestImport

libimage/import_test.go:11–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestImport(t *testing.T) {
12 runtime, cleanup := testNewRuntime(t)
13 defer cleanup()
14 ctx := context.Background()
15
16 importOptions := &ImportOptions{}
17 importOptions.Writer = os.Stdout
18
19 for _, tag := range []string{"", "foobar"} {
20 importOptions.Tag = tag
21 imported, err := runtime.Import(ctx, "testdata/exported-container.tar", importOptions)
22 require.NoError(t, err)
23
24 image, resolvedName, err := runtime.LookupImage(imported, nil)
25 require.NoError(t, err)
26 require.Equal(t, imported, resolvedName)
27 require.Equal(t, "sha256:"+image.ID(), imported)
28
29 if tag != "" {
30 _, _, err := runtime.LookupImage(tag, nil)
31 require.NoError(t, err)
32 }
33 }
34}

Callers

nothing calls this directly

Calls 5

testNewRuntimeFunction · 0.85
ImportMethod · 0.80
LookupImageMethod · 0.80
cleanupFunction · 0.50
IDMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…