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

Address miscellaneous issues throughout code base #452

Merged
merged 2 commits into from
Oct 11, 2023
Merged
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
4 changes: 0 additions & 4 deletions internal/controller/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ var (
ctx = ctrl.SetupSignalHandler()
)

func init() {
rand.Seed(time.Now().UnixNano())
}

func TestMain(m *testing.M) {

utilruntime.Must(imagev1.AddToScheme(scheme.Scheme))
Expand Down
2 changes: 0 additions & 2 deletions internal/policy/numerical_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package policy
import (
"math/rand"
"testing"
"time"
)

func TestNewNumerical(t *testing.T) {
Expand Down Expand Up @@ -146,7 +145,6 @@ func TestNumerical_Latest(t *testing.T) {
}

func shuffle(list []string) []string {
rand.Seed(time.Now().UnixNano())
rand.Shuffle(len(list), func(i, j int) { list[i], list[j] = list[j], list[i] })
return list
}
8 changes: 4 additions & 4 deletions internal/secret/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func parseAuthMap(config dockerConfig) (map[string]authn.AuthConfig, error) {

func getURLHost(urlStr string) (string, error) {
if urlStr == "http://" || urlStr == "https://" {
return "", errors.New("Empty url")
return "", errors.New("empty url")
}

// ensure url has https:// or http:// prefix
Expand All @@ -220,9 +220,9 @@ func getURLHost(urlStr string) (string, error) {
}

if u.Host == "" {
return "", errors.New(fmt.Sprintf(
"Invalid registry auth key: %s. Expected an HTTPS URL (e.g. 'https://index.docker.io/v2/' or 'https://index.docker.io'), or the same without the 'https://' (e.g., 'index.docker.io/v2/' or 'index.docker.io')",
urlStr))
return "", fmt.Errorf(
"expected an HTTPS URL instead of '%s' (e.g. 'https://index.docker.io/v2/' or 'https://index.docker.io'), or the same without 'https://' (e.g., 'index.docker.io/v2/' or 'index.docker.io')",
urlStr)
}

return u.Host, nil
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ type ProviderConfig struct {
pushFluxTestImages pushTestImages
}

func init() {
rand.Seed(time.Now().UnixNano())
}

var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz1234567890")

func randStringRunes(n int) string {
Expand Down