File: oci_src_test.go

package info (click to toggle)
golang-github-containers-image 5.36.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 5,152 kB
  • sloc: sh: 267; makefile: 100
file content (26 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package archive

import (
	"path/filepath"
	"testing"

	"github.com/containers/image/v5/internal/private"
	"github.com/containers/image/v5/types"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

var _ private.ImageSource = (*ociArchiveImageSource)(nil)

func TestNewImageSourceNotFound(t *testing.T) {
	sysctx := types.SystemContext{}
	emptyDir := t.TempDir()
	archivePath := filepath.Join(emptyDir, "foo.ociarchive")
	imgref, err := ParseReference(archivePath)
	require.NoError(t, err)
	_, err = LoadManifestDescriptorWithContext(&sysctx, imgref)
	assert.NotNil(t, err)
	var aerr ArchiveFileNotFoundError
	assert.ErrorAs(t, err, &aerr)
	assert.Equal(t, aerr.path, archivePath)
}