Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip TestGetVerifiedHash when internet connectivity is slow or missing #3849

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packaging/rpm/crc.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export GOFLAGS="-mod=vendor"
mkdir embed-files
cp /usr/bin/crc-driver-libvirt embed-files
cp /usr/bin/crc-admin-helper embed-files/crc-admin-helper-linux
make COMMIT_SHA=__COMMIT_SHA__ GO_EXTRA_LDFLAGS="-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" GO_EXTRA_BUILDFLAGS="" CUSTOM_EMBED=true EMBED_DOWNLOAD_DIR=embed-files/ release
make CRC_IN_DISCONNECTED_ENV=true COMMIT_SHA=__COMMIT_SHA__ GO_EXTRA_LDFLAGS="-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" GO_EXTRA_BUILDFLAGS="" CUSTOM_EMBED=true EMBED_DOWNLOAD_DIR=embed-files/ release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRC_IN_DISCONNECTED_ENV=1 is more common imo. However, I would not add this check here, as the rpm builds we are making on github for example are not disconnected. This can go in the spec file used on platforms where the builders don't have network access.


%install
# with fedora macros: gopkginstall
Expand Down
7 changes: 7 additions & 0 deletions pkg/crc/machine/bundle/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package bundle
import (
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
"testing"
"unicode"
Expand Down Expand Up @@ -188,6 +190,11 @@ func TestGetBundleType(t *testing.T) {
}

func TestVerifiedHash(t *testing.T) {
// skip the test when running in disconnected env
if disconnected, _ := strconv.ParseBool(os.Getenv("CRC_IN_DISCONNECTED_ENV")); disconnected {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just use LookupEnv and would not try to parse it/... If it's set, ignore the test. But I'm fine with the way you wrote it.

t.Skip("Skipping test since running in disconnected env")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are ignoring the error then why not just ?

if os.Getenv("CRC_IN_DISCONNECTED_ENV") == "true" {
 ...
}


sha256sum, err := getVerifiedHash("https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/bundles/openshift/4.13.0/sha256sum.txt.sig", "crc_libvirt_4.13.0_amd64.crcbundle")
require.NoError(t, err)
require.Equal(t, "6aad57019aaab95b670378f569b3f4a16398da0358dd1057996453a8d6d92212", sha256sum)
Expand Down
Loading