Skip to content

Commit f8b98c1

Browse files
committed
Fix CI test linting
1 parent 556a721 commit f8b98c1

1 file changed

Lines changed: 46 additions & 46 deletions

File tree

internal/controller/argo_test.go

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,52 +1020,52 @@ var _ = Describe("CreateOrUpdateArgoCD", func() {
10201020
})
10211021
})
10221022

1023-
Context("when the ArgoCD instance exists with additional spec fields not managed by patterns-operator", func() {
1024-
BeforeEach(func() {
1025-
argoCD := &unstructured.Unstructured{
1026-
Object: map[string]any{
1027-
"apiVersion": "argoproj.io/v1beta1",
1028-
"kind": "ArgoCD",
1029-
"metadata": map[string]any{
1030-
"name": name,
1031-
"namespace": namespace,
1032-
"resourceVersion": "1",
1033-
},
1034-
"spec": map[string]any{
1035-
"networkPolicy": map[string]any{
1036-
"enabled": true,
1037-
},
1038-
"imageUpdater": map[string]any{
1039-
"enabled": false,
1040-
},
1041-
},
1042-
},
1043-
}
1044-
_, err := dynamicClient.Resource(gvr).Namespace(namespace).Create(context.TODO(), argoCD, metav1.CreateOptions{})
1045-
Expect(err).ToNot(HaveOccurred())
1046-
})
1047-
1048-
It("should preserve spec fields not managed by patterns-operator during update", func() {
1049-
err := createOrUpdateArgoCD(dynamicClient, nil, name, namespace, patternsOperatorConfig)
1050-
Expect(err).ToNot(HaveOccurred())
1051-
1052-
argoCD, err := dynamicClient.Resource(gvr).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{})
1053-
Expect(err).ToNot(HaveOccurred())
1054-
1055-
// networkPolicy should be preserved — it is managed by gitops-operator
1056-
// not by patterns-operator, so the update must not strip it
1057-
networkPolicy, found, err := unstructured.NestedMap(argoCD.Object, "spec", "networkPolicy")
1058-
Expect(err).ToNot(HaveOccurred())
1059-
Expect(found).To(BeTrue(), "networkPolicy should be preserved after update")
1060-
Expect(networkPolicy["enabled"]).To(BeTrue())
1061-
1062-
// imageUpdater should also be preserved
1063-
imageUpdater, found, err := unstructured.NestedMap(argoCD.Object, "spec", "imageUpdater")
1064-
Expect(err).ToNot(HaveOccurred())
1065-
Expect(found).To(BeTrue(), "imageUpdater should be preserved after update")
1066-
Expect(imageUpdater["enabled"]).To(BeFalse())
1067-
})
1068-
})
1023+
Context("when the ArgoCD instance exists with additional spec fields not managed by patterns-operator", func() {
1024+
BeforeEach(func() {
1025+
argoCD := &unstructured.Unstructured{
1026+
Object: map[string]any{
1027+
"apiVersion": "argoproj.io/v1beta1",
1028+
"kind": "ArgoCD",
1029+
"metadata": map[string]any{
1030+
"name": name,
1031+
"namespace": namespace,
1032+
"resourceVersion": "1",
1033+
},
1034+
"spec": map[string]any{
1035+
"networkPolicy": map[string]any{
1036+
"enabled": true,
1037+
},
1038+
"imageUpdater": map[string]any{
1039+
"enabled": false,
1040+
},
1041+
},
1042+
},
1043+
}
1044+
_, err := dynamicClient.Resource(gvr).Namespace(namespace).Create(context.TODO(), argoCD, metav1.CreateOptions{})
1045+
Expect(err).ToNot(HaveOccurred())
1046+
})
1047+
1048+
It("should preserve spec fields not managed by patterns-operator during update", func() {
1049+
err := createOrUpdateArgoCD(dynamicClient, nil, name, namespace, patternsOperatorConfig)
1050+
Expect(err).ToNot(HaveOccurred())
1051+
1052+
argoCD, err := dynamicClient.Resource(gvr).Namespace(namespace).Get(context.TODO(), name, metav1.GetOptions{})
1053+
Expect(err).ToNot(HaveOccurred())
1054+
1055+
// networkPolicy should be preserved — it is managed by gitops-operator
1056+
// not by patterns-operator, so the update must not strip it
1057+
networkPolicy, found, err := unstructured.NestedMap(argoCD.Object, "spec", "networkPolicy")
1058+
Expect(err).ToNot(HaveOccurred())
1059+
Expect(found).To(BeTrue(), "networkPolicy should be preserved after update")
1060+
Expect(networkPolicy["enabled"]).To(BeTrue())
1061+
1062+
// imageUpdater should also be preserved
1063+
imageUpdater, found, err := unstructured.NestedMap(argoCD.Object, "spec", "imageUpdater")
1064+
Expect(err).ToNot(HaveOccurred())
1065+
Expect(found).To(BeTrue(), "imageUpdater should be preserved after update")
1066+
Expect(imageUpdater["enabled"]).To(BeFalse())
1067+
})
1068+
})
10691069

10701070
Context("when there is an error in the getArgoCD fn but there is an argocd", func() {
10711071

0 commit comments

Comments
 (0)