diff --git a/pkg/types/alpine/apk_test.go b/pkg/types/alpine/apk_test.go index 4a5983c94..e6aba40de 100644 --- a/pkg/types/alpine/apk_test.go +++ b/pkg/types/alpine/apk_test.go @@ -53,8 +53,7 @@ func TestAlpinePackage(t *testing.T) { } func TestAlpineMetadataSize(t *testing.T) { - os.Setenv("MAX_APK_METADATA_SIZE", "10") - viper.AutomaticEnv() + viper.Set("max_apk_metadata_size", 10) inputArchive, err := os.Open("tests/test_alpine.apk") if err != nil { diff --git a/pkg/types/alpine/fuzz_test.go b/pkg/types/alpine/fuzz_test.go index 4f67b482a..f0b45a2ab 100644 --- a/pkg/types/alpine/fuzz_test.go +++ b/pkg/types/alpine/fuzz_test.go @@ -17,12 +17,22 @@ package alpine import ( "bytes" + "fmt" "testing" + "github.com/spf13/viper" + fuzz "github.com/AdamKorcz/go-fuzz-headers-1" utils "github.com/sigstore/rekor/pkg/fuzz" ) +func init() { + viper.Set("max_apk_metadata_size", 60000) + if viper.GetUint64("max_apk_metadata_size") != 60000 { + panic(fmt.Sprintf("max metadata size is not defined: %d", viper.GetUint64("max_apk_metadata_size"))) + } +} + // FuzzPackageUnmarshal implements the fuzz test func FuzzPackageUnmarshal(f *testing.F) { f.Fuzz(func(t *testing.T, data []byte) {