test: add v3 directory loader budget test

Mirror the v2 `TestLoadDirExceedsBudget` test for the v3 loader
to prevent budget enforcement regressions in either path.

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
pull/31748/head
Benoit Tigeot 3 months ago
parent 0a59858527
commit cb07797566
No known key found for this signature in database
GPG Key ID: 8E6D4FC8AEBDA62C

@ -51,6 +51,20 @@ func TestLoadDir(t *testing.T) {
verifyDependenciesLock(t, c)
}
func TestLoadDirExceedsBudget(t *testing.T) {
orig := archive.MaxDecompressedChartSize
archive.MaxDecompressedChartSize = 1 // 1 byte budget
defer func() { archive.MaxDecompressedChartSize = orig }()
_, err := LoadDir("testdata/frobnitz")
if err == nil {
t.Fatal("expected error when chart directory exceeds budget")
}
if !strings.Contains(err.Error(), "chart exceeds maximum decompressed size") {
t.Fatalf("unexpected error: %v", err)
}
}
func TestLoadDirWithDevNull(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("test only works on unix systems with /dev/null present")

Loading…
Cancel
Save