Add test for #248, ensure objects in loops are not being reused

This commit is contained in:
seanson@users.noreply.github.com 2020-02-22 13:13:34 +11:00
parent 1042019541
commit 7f80562522
No known key found for this signature in database
GPG key ID: 356A1B69190BEB01

View file

@ -136,9 +136,8 @@ func TestArgoCDControllerServiceMonitors(t *testing.T) {
},
}
var servicemonitor monitoringv1.ServiceMonitor
for _, test := range tests {
var servicemonitor monitoringv1.ServiceMonitor
options := &helm.Options{
SetValues: test.SetValues,
KubectlOptions: k8s.NewKubectlOptions("", "", "default"),
@ -191,9 +190,8 @@ func TestArgoCDEnvironmentConfig(t *testing.T) {
},
}
var deployment appsv1.Deployment
for _, test := range tests {
var deployment appsv1.Deployment
options := &helm.Options{
SetValues: test.SetValues,
KubectlOptions: k8s.NewKubectlOptions("", "", "default"),
@ -242,9 +240,8 @@ func TestArgoCDRepoServerCustomTools(t *testing.T) {
},
}
var deployment appsv1.Deployment
for _, test := range tests {
var deployment appsv1.Deployment
options := &helm.Options{
SetValues: test.SetValues,
KubectlOptions: k8s.NewKubectlOptions("", "", "default"),
@ -301,9 +298,8 @@ func TestArgoCDControllerPrometheusRules(t *testing.T) {
},
}
var servicemonitor monitoringv1.PrometheusRule
for _, test := range tests {
var servicemonitor monitoringv1.PrometheusRule
options := &helm.Options{
SetValues: test.SetValues,
KubectlOptions: k8s.NewKubectlOptions("", "", "default"),
@ -367,11 +363,18 @@ func TestArgoCDSecurityContext(t *testing.T) {
"global.securityContext.runAsUser": "999",
},
},
{
Name: "Given a global securityContext and a dex deployment",
DeploymentYAML: []string{"templates/dex/deployment.yaml"},
SetValues: map[string]string{
"global.securityContext.runAsUser": "999",
},
},
}
for _, test := range tests {
var deployment appsv1.Deployment
for _, test := range tests {
options := &helm.Options{
SetValues: test.SetValues,
KubectlOptions: k8s.NewKubectlOptions("", "", "default"),