-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix where we are deleting tags (don't edit cache\!) (#1112)
## Description Fixes a bug introduced from MZAL where cache could be messed with do to GitPath being changed in the git receiver. ## Related Issue Fixes #1079 ## Type of change - [X] Bug fix (non-breaking change which fixes an issue)
- Loading branch information
Showing
4 changed files
with
52 additions
and
8 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
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,45 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2021-Present The Zarf Authors | ||
|
||
// Package test provides e2e tests for zarf | ||
package test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestCreateCache(t *testing.T) { | ||
t.Log("E2E: Create Cache") | ||
|
||
e2e.setup(t) | ||
defer e2e.teardown(t) | ||
|
||
// run `zarf package create` with a specified image cache location | ||
cachePath := filepath.Join(os.TempDir(), ".cache-location") | ||
|
||
e2e.cleanFiles(cachePath) | ||
// defer the cleanFiles action because of how the zarf command is lauched as a separate process | ||
// and may return earlier clearing the cache and not properly checking for a failure | ||
defer e2e.cleanFiles(cachePath) | ||
|
||
pkgName := fmt.Sprintf("zarf-package-git-data-%s-v1.0.0.tar.zst", e2e.arch) | ||
|
||
// Test that not specifying a package variable results in an error | ||
stdOut, stdErr, err := e2e.execZarfCommand("package", "create", "examples/git-data", "--confirm", "--zarf-cache", cachePath) | ||
require.NoError(t, err, stdOut, stdErr) | ||
|
||
// Test that the cache can be used at least once | ||
stdOut, stdErr, err = e2e.execZarfCommand("package", "create", "examples/git-data", "--confirm", "--zarf-cache", cachePath) | ||
require.NoError(t, err, stdOut, stdErr) | ||
|
||
// Test that the cache is not corrupted when used | ||
stdOut, stdErr, err = e2e.execZarfCommand("package", "create", "examples/git-data", "--confirm", "--zarf-cache", cachePath) | ||
require.NoError(t, err, stdOut, stdErr) | ||
|
||
e2e.cleanFiles(pkgName) | ||
} |