From 00a8d9ec41e5155e5380a38c94b993520b7a99a8 Mon Sep 17 00:00:00 2001 From: Medya Ghazizadeh Date: Wed, 24 Sep 2025 17:18:15 -0700 Subject: [PATCH] dont read all tarball in integration test --- test/integration/aaa_download_only_test.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test/integration/aaa_download_only_test.go b/test/integration/aaa_download_only_test.go index e401eddc6a..6668260167 100644 --- a/test/integration/aaa_download_only_test.go +++ b/test/integration/aaa_download_only_test.go @@ -22,7 +22,6 @@ import ( "bufio" "bytes" "context" - "crypto/md5" "crypto/sha256" "encoding/json" "fmt" @@ -235,23 +234,19 @@ func TestDownloadOnlyKic(t *testing.T) { // Make sure the downloaded image tarball exists tarball := download.TarballPath(constants.DefaultKubernetesVersion, cRuntime) - contents, err := os.ReadFile(tarball) + fi, err := os.Stat(tarball) if err != nil { - t.Errorf("failed to read tarball file %q: %v", tarball, err) + t.Errorf("expected tarball file %q to exist, but got error: %v", tarball, err) + } else { + const minSize int64 = 200 * 1024 * 1024 // 200 MB + if fi.Size() <= minSize { + t.Errorf("expected tarball file %q to be larger than 200MB (>%d bytes), got %d bytes", tarball, minSize, fi.Size()) + } } if arm64Platform() { t.Skip("Skip for arm64 platform. See https://github.com/kubernetes/minikube/issues/10144") } - // Make sure it has the correct checksum - checksum := md5.Sum(contents) - remoteChecksum, err := os.ReadFile(download.PreloadChecksumPath(constants.DefaultKubernetesVersion, cRuntime)) - if err != nil { - t.Errorf("failed to read checksum file %q : %v", download.PreloadChecksumPath(constants.DefaultKubernetesVersion, cRuntime), err) - } - if string(remoteChecksum) != string(checksum[:]) { - t.Errorf("failed to verify checksum. checksum of %q does not match remote checksum (%q != %q)", tarball, string(remoteChecksum), string(checksum[:])) - } } // createSha256File is a helper function which creates sha256 checksum file from given file