Skip to content

Commit ffd6fbb

Browse files
committed
reduce sonarcloud issues
Signed-off-by: Atif Ali <[email protected]>
1 parent 257d9de commit ffd6fbb

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

pkg/sync/sync_context_test.go

+22-18
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ import (
3939
)
4040

4141
const (
42-
testAPIVersion = "apps/v1"
43-
testStatefulSet = "test-statefulset"
44-
testNamespace = "default"
42+
testAPIVersion = "apps/v1"
43+
testStatefulSet = "test-statefulset"
44+
testNamespace = "default"
45+
staticFiles = "static-files"
46+
argocdDexServerTLS = "argocd-dex-server-tls"
47+
postgresqlSvc = "postgresql-svc"
48+
dexconfig = "dexconfig"
4549
)
4650

4751
var standardVerbs = v1.Verbs{"create", "delete", "deletecollection", "get", "list", "patch", "update", "watch"}
@@ -2204,29 +2208,29 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
22042208
{
22052209
name: "multiple volumeClaimTemplate change",
22062210
currentSpec: map[string]interface{}{
2207-
"serviceName": "postgresql-svc",
2211+
"serviceName": postgresqlSvc,
22082212
"selector": map[string]interface{}{
22092213
"matchLabels": map[string]interface{}{
22102214
"app": "postgresql",
22112215
},
22122216
},
22132217
"volumeClaimTemplates": []interface{}{
2214-
templateWithStorage("static-files", "1Gi"),
2215-
templateWithStorage("dexconfig", "1Gi"),
2216-
templateWithStorage("argocd-dex-server-tls", "1Gi"),
2218+
templateWithStorage(staticFiles, "1Gi"),
2219+
templateWithStorage(dexconfig, "1Gi"),
2220+
templateWithStorage(argocdDexServerTLS, "1Gi"),
22172221
},
22182222
},
22192223
desiredSpec: map[string]interface{}{
2220-
"serviceName": "postgresql-svc",
2224+
"serviceName": postgresqlSvc,
22212225
"selector": map[string]interface{}{
22222226
"matchLabels": map[string]interface{}{
22232227
"app": "postgresql",
22242228
},
22252229
},
22262230
"volumeClaimTemplates": []interface{}{
2227-
templateWithStorage("static-files", "2Gi"),
2228-
templateWithStorage("dexconfig", "3Gi"),
2229-
templateWithStorage("argocd-dex-server-tls", "4Gi"),
2231+
templateWithStorage(staticFiles, "2Gi"),
2232+
templateWithStorage(dexconfig, "3Gi"),
2233+
templateWithStorage(argocdDexServerTLS, "4Gi"),
22302234
},
22312235
},
22322236
expectedMessage: `attempting to change immutable fields:
@@ -2245,16 +2249,16 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
22452249
{
22462250
name: "multiple field changes",
22472251
currentSpec: map[string]interface{}{
2248-
"serviceName": "postgresql-svc",
2252+
"serviceName": postgresqlSvc,
22492253
"selector": map[string]interface{}{
22502254
"matchLabels": map[string]interface{}{
22512255
"app": "postgresql",
22522256
},
22532257
},
22542258
"volumeClaimTemplates": []interface{}{
2255-
templateWithStorage("static-files", "1Gi"),
2256-
templateWithStorage("dexconfig", "1Gi"),
2257-
templateWithStorage("argocd-dex-server-tls", "1Gi"),
2259+
templateWithStorage(staticFiles, "1Gi"),
2260+
templateWithStorage(dexconfig, "1Gi"),
2261+
templateWithStorage(argocdDexServerTLS, "1Gi"),
22582262
},
22592263
},
22602264
desiredSpec: map[string]interface{}{
@@ -2265,9 +2269,9 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
22652269
},
22662270
},
22672271
"volumeClaimTemplates": []interface{}{
2268-
templateWithStorage("static-files", "2Gi"),
2269-
templateWithStorage("dexconfig", "1Gi"),
2270-
templateWithStorage("argocd-dex-server-tls", "1Gi"),
2272+
templateWithStorage(staticFiles, "2Gi"),
2273+
templateWithStorage(dexconfig, "1Gi"),
2274+
templateWithStorage(argocdDexServerTLS, "1Gi"),
22712275
},
22722276
},
22732277
expectedMessage: `attempting to change immutable fields:

0 commit comments

Comments
 (0)