Skip to content

Commit

Permalink
refactor(tests): reconcile_test
Browse files Browse the repository at this point in the history
  • Loading branch information
ansh-devs committed Jul 22, 2024
1 parent df66c98 commit dd31159
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion pkg/configuration/base/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ func Test_compareEnv(t *testing.T) {
var actual []corev1.EnvVar

got := compareEnv(expected, actual)

assert.True(t, got)
})
t.Run("same", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/configuration/base/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func compareMap(expected, actual map[string]string) bool {
}

func compareEnv(expected, actual []corev1.EnvVar) bool {
actualEnv := []corev1.EnvVar{}
var actualEnv []corev1.EnvVar

Check failure on line 267 in pkg/configuration/base/reconciler.go

View workflow job for this annotation

GitHub Actions / HELM Verify code before tests

Consider pre-allocating `actualEnv` (prealloc)

Check failure on line 267 in pkg/configuration/base/reconciler.go

View workflow job for this annotation

GitHub Actions / E2E Verify code before tests

Consider pre-allocating `actualEnv` (prealloc)
for _, env := range actual {
if env.Name == "KUBERNETES_PORT_443_TCP_ADDR" || env.Name == "KUBERNETES_PORT" ||
env.Name == "KUBERNETES_PORT_443_TCP" || env.Name == "KUBERNETES_SERVICE_HOST" {
Expand All @@ -289,7 +289,7 @@ func CompareContainerVolumeMounts(expected corev1.Container, actual corev1.Conta

// compareVolumes returns true if Jenkins pod and Jenkins CR volumes are the same
func (r *JenkinsBaseConfigurationReconciler) compareVolumes(actualPod corev1.Pod) bool {
toCompare := []corev1.Volume{}
var toCompare []corev1.Volume

Check failure on line 292 in pkg/configuration/base/reconciler.go

View workflow job for this annotation

GitHub Actions / HELM Verify code before tests

Consider pre-allocating `toCompare` (prealloc)

Check failure on line 292 in pkg/configuration/base/reconciler.go

View workflow job for this annotation

GitHub Actions / E2E Verify code before tests

Consider pre-allocating `toCompare` (prealloc)
for _, volume := range actualPod.Spec.Volumes {
// filter out service account
if strings.HasPrefix(volume.Name, actualPod.Spec.ServiceAccountName) {
Expand Down

0 comments on commit dd31159

Please sign in to comment.