test(downloader): assert a rejected chart leaves nothing in dest

Signed-off-by: ashvinctrl <sharmaashvin27@gmail.com>
pull/32687/head
ashvinctrl 1 week ago
parent 871780c051
commit 46e958ab6e

@ -565,6 +565,11 @@ func TestDownloadTo_RejectsChartNotMatchingIndexDigest(t *testing.T) {
_, _, err := c.DownloadTo("test/signtest", "0.1.0", dest) _, _, err := c.DownloadTo("test/signtest", "0.1.0", dest)
require.Error(t, err, "a chart that does not match the index digest must not be accepted") require.Error(t, err, "a chart that does not match the index digest must not be accepted")
assert.Contains(t, err.Error(), "does not match the digest recorded for it in the repository index") assert.Contains(t, err.Error(), "does not match the digest recorded for it in the repository index")
// Nothing may be left behind in dest for a later step to pick up.
entries, err := os.ReadDir(dest)
require.NoError(t, err)
assert.Empty(t, entries, "rejected chart must not be written to the destination")
} }
func TestDownloadToCache_RejectsChartNotMatchingIndexDigest(t *testing.T) { func TestDownloadToCache_RejectsChartNotMatchingIndexDigest(t *testing.T) {

Loading…
Cancel
Save