Skip to content

Commit 3e8f37b

Browse files
committed
Fix linter again
1 parent b71ca35 commit 3e8f37b

3 files changed

Lines changed: 29 additions & 28 deletions

File tree

internal/controller/argo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ return health_status`,
248248
})
249249
}
250250

251-
if customChecksYAML := patternsOperatorConfig.getStringValue("gitops.customHealthChecks"); customChecksYAML != "" {
251+
if customChecksYAML := patternsOperatorConfig.getStringValue(configKeyCustomHealthCheck); customChecksYAML != "" {
252252
var customChecks []argooperator.ResourceHealthCheck
253253
if err := yaml.Unmarshal([]byte(customChecksYAML), &customChecks); err != nil {
254-
log.Printf("Failed to parse gitops.customHealthChecks: %v", err)
254+
log.Printf("Failed to parse %s: %v", configKeyCustomHealthCheck, err)
255255
} else {
256256
resourceHealthChecks = append(resourceHealthChecks, customChecks...)
257257
}

internal/controller/argo_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ var _ = Describe("newArgoCD", func() {
22562256
hs = {}
22572257
hs.status = "Progressing"
22582258
return hs`
2259-
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{"gitops.customHealthChecks": customYAML})
2259+
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{configKeyCustomHealthCheck: customYAML})
22602260
Expect(argo.Spec.ResourceHealthChecks).To(HaveLen(4))
22612261
Expect(argo.Spec.ResourceHealthChecks[0].Kind).To(Equal("PersistentVolumeClaim"))
22622262
Expect(argo.Spec.ResourceHealthChecks[1].Group).To(Equal("operators.coreos.com"))
@@ -2275,7 +2275,7 @@ var _ = Describe("newArgoCD", func() {
22752275
return hs`
22762276
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{
22772277
"gitops.applicationHealthCheckEnabled": "true",
2278-
"gitops.customHealthChecks": customYAML,
2278+
configKeyCustomHealthCheck: customYAML,
22792279
})
22802280
Expect(argo.Spec.ResourceHealthChecks).To(HaveLen(4))
22812281
Expect(argo.Spec.ResourceHealthChecks[0].Kind).To(Equal("PersistentVolumeClaim"))
@@ -2285,14 +2285,14 @@ var _ = Describe("newArgoCD", func() {
22852285
})
22862286

22872287
It("should handle invalid YAML in gitops.customHealthChecks gracefully", func() {
2288-
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{"gitops.customHealthChecks": "not: valid: yaml: list"})
2288+
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{configKeyCustomHealthCheck: "not: valid: yaml: list"})
22892289
Expect(argo.Spec.ResourceHealthChecks).To(HaveLen(2))
22902290
Expect(argo.Spec.ResourceHealthChecks[0].Kind).To(Equal("PersistentVolumeClaim"))
22912291
Expect(argo.Spec.ResourceHealthChecks[1].Group).To(Equal("operators.coreos.com"))
22922292
})
22932293

22942294
It("should not add custom health checks when gitops.customHealthChecks is empty", func() {
2295-
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{"gitops.customHealthChecks": ""})
2295+
argo = newArgoCD("test-argo", "test-ns", PatternsOperatorConfig{configKeyCustomHealthCheck: ""})
22962296
Expect(argo.Spec.ResourceHealthChecks).To(HaveLen(2))
22972297
})
22982298

internal/controller/patterns_operator_config.go

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,32 @@ import (
1313
type PatternsOperatorConfig map[string]string
1414

1515
const (
16-
configKeyCatalogSource = "gitops.catalogSource"
17-
configKeyChannel = "gitops.channel"
18-
configKeySourceNamespace = "gitops.sourceNamespace"
19-
configKeyApprovalPlan = "gitops.installApprovalPlan"
20-
configKeyCSV = "gitops.csv"
21-
configKeyAdditionalAdmins = "gitops.additionalArgoAdmins"
22-
configKeyHealthCheck = "gitops.applicationHealthCheckEnabled"
23-
configMapKind = "ConfigMap"
24-
boolTrue = "true"
25-
boolFalse = "false"
16+
configKeyCatalogSource = "gitops.catalogSource"
17+
configKeyChannel = "gitops.channel"
18+
configKeySourceNamespace = "gitops.sourceNamespace"
19+
configKeyApprovalPlan = "gitops.installApprovalPlan"
20+
configKeyCSV = "gitops.csv"
21+
configKeyAdditionalAdmins = "gitops.additionalArgoAdmins"
22+
configKeyHealthCheck = "gitops.applicationHealthCheckEnabled"
23+
configKeyCustomHealthCheck = "gitops.customHealthChecks"
24+
configMapKind = "ConfigMap"
25+
boolTrue = "true"
26+
boolFalse = "false"
2627
)
2728

2829
var DefaultPatternsOperatorConfig = PatternsOperatorConfig{
29-
configKeyCatalogSource: GitOpsDefaultCatalogSource,
30-
configKeyChannel: GitOpsDefaultChannel,
31-
configKeySourceNamespace: GitOpsDefaultCatalogSourceNamespace,
32-
configKeyApprovalPlan: GitOpsDefaultApprovalPlan,
33-
configKeyCSV: GitOpsDefaultCSV,
34-
configKeyAdditionalAdmins: "",
35-
configKeyHealthCheck: boolFalse,
36-
"gitops.customHealthChecks": "",
37-
"gitea.chartName": GiteaChartName,
38-
"gitea.helmRepoUrl": GiteaHelmRepoUrl,
39-
"gitea.chartVersion": GiteaDefaultChartVersion,
40-
"catalog.image": "",
30+
configKeyCatalogSource: GitOpsDefaultCatalogSource,
31+
configKeyChannel: GitOpsDefaultChannel,
32+
configKeySourceNamespace: GitOpsDefaultCatalogSourceNamespace,
33+
configKeyApprovalPlan: GitOpsDefaultApprovalPlan,
34+
configKeyCSV: GitOpsDefaultCSV,
35+
configKeyAdditionalAdmins: "",
36+
configKeyHealthCheck: boolFalse,
37+
configKeyCustomHealthCheck: "",
38+
"gitea.chartName": GiteaChartName,
39+
"gitea.helmRepoUrl": GiteaHelmRepoUrl,
40+
"gitea.chartVersion": GiteaDefaultChartVersion,
41+
"catalog.image": "",
4142
}
4243

4344
func (g PatternsOperatorConfig) getStringValue(k string) string {

0 commit comments

Comments
 (0)