MCPcopy Create free account
hub / github.com/containers/image / refToTempFile

Function refToTempFile

sif/transport_test.go:77–86  ·  view source on GitHub ↗

refToTempFile creates a temporary file and returns a reference to it. The caller should defer os.Remove(tmpFile)

(t *testing.T)

Source from the content-addressed store, hash-verified

75//
76// defer os.Remove(tmpFile)
77func refToTempFile(t *testing.T) (ref types.ImageReference, tmpDir string) {
78 f, err := os.CreateTemp("", "sif-transport-test")
79 require.NoError(t, err)
80 tmpFile := f.Name()
81 err = f.Close()
82 require.NoError(t, err)
83 ref, err = NewReference(tmpFile)
84 require.NoError(t, err)
85 return ref, tmpFile
86}
87
88func TestReferenceTransport(t *testing.T) {
89 ref, tmpFile := refToTempFile(t)

Calls 3

NewReferenceFunction · 0.70
NameMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…