Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fixlastappliedconfig' into fixla…
Browse files Browse the repository at this point in the history
…stappliedconfig
  • Loading branch information
mfrancisc committed Apr 9, 2024
2 parents 7ed09c1 + 0b781ea commit ae37c06
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/cluster/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ func ListToolchainClusterConfigs(cl client.Client, namespace string, timeout tim
}
var configs []*Config
for _, cluster := range toolchainClusters.Items {
clusterConfig, err := NewClusterConfig(cl, &cluster, timeout) // nolint:gosec
cluster := cluster // TODO We won't need it after upgrading to go 1.22: https://go.dev/blog/loopvar-preview
clusterConfig, err := NewClusterConfig(cl, &cluster, timeout)
if err != nil {
return nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/template/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package template

import (
"fmt"
"math/rand" //nolint:gosec
"math/rand"
"time"

templatev1 "github.com/openshift/api/template/v1"
Expand Down Expand Up @@ -36,6 +36,7 @@ func (p Processor) Process(tmpl *templatev1.Template, values map[string]string,
v.Generate = ""
}
}

// convert the template into a set of objects
tmplProcessor := templateprocessing.NewProcessor(map[string]generator.Generator{
"expression": generator.NewExpressionValueGenerator(rand.New(rand.NewSource(time.Now().UnixNano()))), //nolint:gosec
Expand Down
8 changes: 4 additions & 4 deletions pkg/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func TestLoadObjectsFromEmbedFS(t *testing.T) {
require.NotNil(t, allObjects)
require.NotNil(t, hostFolderObjects)
require.NotNil(t, memberFolderObjects)
require.Equal(t, 4, len(allObjects), "invalid number of expected total objects")
require.Equal(t, 3, len(hostFolderObjects), "invalid number of expected objects from host folder")
require.Equal(t, 1, len(memberFolderObjects), "invalid number of expected objects from member folder")
require.Len(t, allObjects, 4, "invalid number of expected total objects")
require.Len(t, hostFolderObjects, 3, "invalid number of expected objects from host folder")
require.Len(t, memberFolderObjects, 1, "invalid number of expected objects from member folder")
// check match for the expected objects
checkExpectedObjects(t, allObjects)
})
Expand Down Expand Up @@ -81,7 +81,7 @@ func checkExpectedObjects(t *testing.T, objects []*unstructured.Unstructured) {
Kind: "Role",
Name: "toolchaincluster-host",
}, roleBinding.RoleRef)
require.Equal(t, 1, len(roleBinding.Subjects))
require.Len(t, roleBinding.Subjects, 1)
require.Equal(t, rbac.Subject{
Kind: "ServiceAccount",
Name: "toolchaincluster-host",
Expand Down

0 comments on commit ae37c06

Please sign in to comment.