-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #2591 ## Checklist before merging - [ ] Test, docs, adr added or updated as needed - [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow) followed
- Loading branch information
1 parent
d62ce1f
commit b2b504b
Showing
4 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors | ||
|
||
// Package images provides functions for building and pushing images. | ||
package images | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/defenseunicorns/zarf/src/pkg/transform" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPull(t *testing.T) { | ||
t.Run("pulling a cosign image is successful and doesn't add anything to the cache", func(t *testing.T) { | ||
ref, err := transform.ParseImageRef("ghcr.io/stefanprodan/podinfo:sha256-57a654ace69ec02ba8973093b6a786faa15640575fbf0dbb603db55aca2ccec8.sig") | ||
require.NoError(t, err) | ||
destDir := t.TempDir() | ||
cacheDir := t.TempDir() | ||
pullConfig := PullConfig{ | ||
DestinationDirectory: destDir, | ||
CacheDirectory: cacheDir, | ||
ImageList: []transform.Image{ | ||
ref, | ||
}, | ||
} | ||
|
||
_, err = Pull(context.Background(), pullConfig) | ||
require.NoError(t, err) | ||
require.FileExists(t, filepath.Join(destDir, "blobs/sha256/3e84ea487b4c52a3299cf2996f70e7e1721236a0998da33a0e30107108486b3e")) | ||
|
||
dir, err := os.ReadDir(cacheDir) | ||
require.NoError(t, err) | ||
require.Empty(t, dir) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters