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

go 1.21 #861

Merged
merged 3 commits into from
Sep 21, 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
2 changes: 1 addition & 1 deletion .github/env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang-version=1.19
golang-version=1.21
operator-sdk-version=v1.26.0
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,12 @@ prep/repos:
# workaround for now. Needs to be removed as we move to v9
cd cnquery && git fetch && git checkout v8
test -x cnspec || git clone https://github.com/mondoohq/cnspec.git
cd cnspec && git fetch && git checkout v8

prep/repos/update: prep/repos
# workaround for now. Needs to be removed as we move to v9
cd cnquery; git fetch; git checkout v8 && git pull; cd -;
cd cnspec; git checkout main && git pull; cd -;
cd cnspec; git checkout v8 && git pull; cd -;

prep/ci/protoc:
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTO_VERSION}/protoc-${PROTO_VERSION}-linux-x86_64.zip
Expand Down
10 changes: 0 additions & 10 deletions controllers/nodes/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ package nodes
import (
"crypto/sha256"
"fmt"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/assert"
"go.mondoo.com/mondoo-operator/api/v1alpha2"
Expand All @@ -31,7 +29,6 @@ const (
)

func TestCronJobName(t *testing.T) {
rand.Seed(time.Now().UnixNano())
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these removed?

Copy link
Member

Choose a reason for hiding this comment

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

The global rand instance has been deprecated. We either need to use a local one or ignore the seed

prefix := "mondoo-client"
tests := []struct {
name string
Expand Down Expand Up @@ -66,14 +63,12 @@ func TestCronJobName(t *testing.T) {
}

func TestGarbageCollectCronJobName(t *testing.T) {
rand.Seed(time.Now().UnixNano())
prefix := "mondoo-client"

assert.Equal(t, fmt.Sprintf("%s%s", prefix, GarbageCollectCronJobNameBase), GarbageCollectCronJobName(prefix))
}

func TestConfigMapName(t *testing.T) {
rand.Seed(time.Now().UnixNano())
prefix := "mondoo-client"
tests := []struct {
name string
Expand Down Expand Up @@ -108,7 +103,6 @@ func TestConfigMapName(t *testing.T) {
}

func TestResources(t *testing.T) {
rand.Seed(time.Now().UnixNano())
tests := []struct {
name string
mondooauditconfig func() *v1alpha2.MondooAuditConfig
Expand Down Expand Up @@ -166,8 +160,6 @@ func TestResources(t *testing.T) {
}

func TestCronJob_PrivilegedOpenshift(t *testing.T) {
rand.Seed(time.Now().UnixNano())

testNode := &corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "test-node-name",
Expand All @@ -180,8 +172,6 @@ func TestCronJob_PrivilegedOpenshift(t *testing.T) {
}

func TestCronJob_Privileged(t *testing.T) {
rand.Seed(time.Now().UnixNano())

testNode := &corev1.Node{
ObjectMeta: metav1.ObjectMeta{
Name: "test-node-name",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module go.mondoo.com/mondoo-operator

go 1.19
go 1.21

require (
github.com/gobwas/glob v0.2.3
Expand Down
Loading