@@ -55,27 +55,31 @@ func (suite *ApplianceTestSuite) gatherResources(namespace string) []client.Obje
55
55
deps , err := suite .k8sClient .AppsV1 ().Deployments (namespace ).List (suite .ctx , metav1.ListOptions {})
56
56
suite .Require ().NoError (err )
57
57
for _ , obj := range deps .Items {
58
+ obj := obj // see exportloopref
58
59
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "apps" , Version : "v1" , Kind : "Deployment" })
59
60
normalizeObj (& obj )
60
61
objs = append (objs , & obj )
61
62
}
62
63
ssets , err := suite .k8sClient .AppsV1 ().StatefulSets (namespace ).List (suite .ctx , metav1.ListOptions {})
63
64
suite .Require ().NoError (err )
64
65
for _ , obj := range ssets .Items {
66
+ obj := obj
65
67
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "apps" , Version : "v1" , Kind : "StatefulSet" })
66
68
normalizeObj (& obj )
67
69
objs = append (objs , & obj )
68
70
}
69
71
cmaps , err := suite .k8sClient .CoreV1 ().ConfigMaps (namespace ).List (suite .ctx , metav1.ListOptions {})
70
72
suite .Require ().NoError (err )
71
73
for _ , obj := range cmaps .Items {
74
+ obj := obj
72
75
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "" , Version : "v1" , Kind : "ConfigMap" })
73
76
normalizeObj (& obj )
74
77
objs = append (objs , & obj )
75
78
}
76
79
pvcs , err := suite .k8sClient .CoreV1 ().PersistentVolumeClaims (namespace ).List (suite .ctx , metav1.ListOptions {})
77
80
suite .Require ().NoError (err )
78
81
for _ , obj := range pvcs .Items {
82
+ obj := obj
79
83
if obj .DeletionTimestamp != nil {
80
84
obj .DeletionTimestamp = & magicTime
81
85
}
@@ -86,6 +90,7 @@ func (suite *ApplianceTestSuite) gatherResources(namespace string) []client.Obje
86
90
pods , err := suite .k8sClient .CoreV1 ().Pods (namespace ).List (suite .ctx , metav1.ListOptions {})
87
91
suite .Require ().NoError (err )
88
92
for _ , obj := range pods .Items {
93
+ obj := obj
89
94
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "" , Version : "v1" , Kind : "Pod" })
90
95
normalizeObj (& obj )
91
96
objs = append (objs , & obj )
@@ -96,6 +101,7 @@ func (suite *ApplianceTestSuite) gatherResources(namespace string) []client.Obje
96
101
secrets , err := suite .k8sClient .CoreV1 ().Secrets (namespace ).List (suite .ctx , metav1.ListOptions {})
97
102
suite .Require ().NoError (err )
98
103
for _ , obj := range secrets .Items {
104
+ obj := obj
99
105
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "" , Version : "v1" , Kind : "Secret" })
100
106
normalizeObj (& obj )
101
107
objs = append (objs , & obj )
@@ -104,13 +110,15 @@ func (suite *ApplianceTestSuite) gatherResources(namespace string) []client.Obje
104
110
sas , err := suite .k8sClient .CoreV1 ().ServiceAccounts (namespace ).List (suite .ctx , metav1.ListOptions {})
105
111
suite .Require ().NoError (err )
106
112
for _ , obj := range sas .Items {
113
+ obj := obj
107
114
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "" , Version : "v1" , Kind : "ServiceAccount" })
108
115
normalizeObj (& obj )
109
116
objs = append (objs , & obj )
110
117
}
111
118
svcs , err := suite .k8sClient .CoreV1 ().Services (namespace ).List (suite .ctx , metav1.ListOptions {})
112
119
suite .Require ().NoError (err )
113
120
for _ , obj := range svcs .Items {
121
+ obj := obj
114
122
obj .Spec .ClusterIP = "NORMALIZED_FOR_TESTING"
115
123
obj .Spec .ClusterIPs = []string {"NORMALIZED_FOR_TESTING" }
116
124
obj .SetGroupVersionKind (schema.GroupVersionKind {Group : "" , Version : "v1" , Kind : "Service" })
0 commit comments