Load the manifest check downloads from memory, not a temp file (closes #223)
check / check (push) Waiting to run
check / check (push) Waiting to run
check given a URL wrote the manifest it downloaded to a file in the temp directory before loading it, so it failed wherever that directory is missing or cannot be written, such as the scratch image script/cibuild builds. It now keeps the manifest in memory, as fetch, list and export do. NewChecker reads a manifest handed to it as a reader through the new CheckerOptions.ManifestReader field, in place of ManifestPath, because it otherwise reads the manifest from the filesystem holding the files it checks. Only check uses that field. verifyRequiredSigner takes the signer's fingerprint instead of a Checker, so fetch passes the signer of the manifest it has already loaded and builds no Checker. Model: opus-5-5
This commit is contained in:
@@ -1167,6 +1167,29 @@ func TestCheckURLManifestResolvesEntriesAgainstCurrentDirectory(t *testing.T) {
|
||||
assert.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||
}
|
||||
|
||||
// TestCheckURLManifestWithoutTempDirectory checks the tree under --base
|
||||
// against a manifest given by URL while TMPDIR names a directory that does
|
||||
// not exist. check keeps the manifest it downloads in memory, so it passes.
|
||||
// Setting TMPDIR keeps it from running in parallel with other tests.
|
||||
func TestCheckURLManifestWithoutTempDirectory(t *testing.T) {
|
||||
files := map[string][]byte{testFileTxt: []byte("hello")}
|
||||
|
||||
server := httptest.NewServer(fetchTestHandler(manifestOf(t, files), files))
|
||||
defer server.Close()
|
||||
|
||||
base := t.TempDir()
|
||||
require.NoError(t,
|
||||
os.WriteFile(filepath.Join(base, testFileTxt), files[testFileTxt], 0o600))
|
||||
|
||||
t.Setenv("TMPDIR", filepath.Join(t.TempDir(), "missing"))
|
||||
|
||||
opts := testOpts([]string{
|
||||
testApp, cmdCheck, testFlagNoExtra, testFlagBase, base,
|
||||
server.URL + "/" + defaultManifestName,
|
||||
}, afero.NewOsFs())
|
||||
assert.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||
}
|
||||
|
||||
// unlistableDirFs is a filesystem on which one directory cannot be listed.
|
||||
type unlistableDirFs struct {
|
||||
afero.Fs
|
||||
|
||||
Reference in New Issue
Block a user