@@ -5,11 +5,12 @@ import (
55 "fmt"
66 "testing"
77
8- monitoringv1 "github.com/coreos /prometheus-operator/pkg/apis/monitoring/v1"
8+ monitoringv1 "github.com/prometheus-operator /prometheus-operator/pkg/apis/monitoring/v1"
99 "github.com/stretchr/testify/assert"
1010 "k8s.io/apimachinery/pkg/runtime"
1111 "k8s.io/apimachinery/pkg/types"
1212 "k8s.io/apimachinery/pkg/util/intstr"
13+ "k8s.io/utils/ptr"
1314 "sigs.k8s.io/controller-runtime/pkg/client"
1415
1516 argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
@@ -72,7 +73,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
7273 Type : intstr .String ,
7374 StrVal : fmt .Sprintf ("kube_statefulset_status_replicas{statefulset=\" %s\" , namespace=\" %s\" } != kube_statefulset_status_replicas_ready{statefulset=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-application-controller" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-application-controller" ), test .argocd .Namespace ),
7475 },
75- For : "1m" ,
76+ For : ptr . To (( monitoringv1 . Duration )( "1m" )) ,
7677 Labels : map [string ]string {
7778 "severity" : "critical" ,
7879 },
@@ -86,7 +87,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
8687 Type : intstr .String ,
8788 StrVal : fmt .Sprintf ("kube_deployment_status_replicas{deployment=\" %s\" , namespace=\" %s\" } != kube_deployment_status_replicas_ready{deployment=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-server" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-server" ), test .argocd .Namespace ),
8889 },
89- For : "1m" ,
90+ For : ptr . To (( monitoringv1 . Duration )( "1m" )) ,
9091 Labels : map [string ]string {
9192 "severity" : "critical" ,
9293 },
@@ -100,7 +101,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
100101 Type : intstr .String ,
101102 StrVal : fmt .Sprintf ("kube_deployment_status_replicas{deployment=\" %s\" , namespace=\" %s\" } != kube_deployment_status_replicas_ready{deployment=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-repo-server" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-repo-server" ), test .argocd .Namespace ),
102103 },
103- For : "1m" ,
104+ For : ptr . To (( monitoringv1 . Duration )( "1m" )) ,
104105 Labels : map [string ]string {
105106 "severity" : "critical" ,
106107 },
@@ -114,7 +115,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
114115 Type : intstr .String ,
115116 StrVal : fmt .Sprintf ("kube_deployment_status_replicas{deployment=\" %s\" , namespace=\" %s\" } != kube_deployment_status_replicas_ready{deployment=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-applicationset-controller" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-applicationset-controller" ), test .argocd .Namespace ),
116117 },
117- For : "5m" ,
118+ For : ptr . To (( monitoringv1 . Duration )( "5m" )) ,
118119 Labels : map [string ]string {
119120 "severity" : "warning" ,
120121 },
@@ -128,7 +129,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
128129 Type : intstr .String ,
129130 StrVal : fmt .Sprintf ("kube_deployment_status_replicas{deployment=\" %s\" , namespace=\" %s\" } != kube_deployment_status_replicas_ready{deployment=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-dex-server" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-dex-server" ), test .argocd .Namespace ),
130131 },
131- For : "5m" ,
132+ For : ptr . To (( monitoringv1 . Duration )( "5m" )) ,
132133 Labels : map [string ]string {
133134 "severity" : "warning" ,
134135 },
@@ -142,7 +143,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
142143 Type : intstr .String ,
143144 StrVal : fmt .Sprintf ("kube_deployment_status_replicas{deployment=\" %s\" , namespace=\" %s\" } != kube_deployment_status_replicas_ready{deployment=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-notifications-controller" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-notifications-controller" ), test .argocd .Namespace ),
144145 },
145- For : "5m" ,
146+ For : ptr . To (( monitoringv1 . Duration )( "5m" )) ,
146147 Labels : map [string ]string {
147148 "severity" : "warning" ,
148149 },
@@ -156,7 +157,7 @@ func TestReconcileWorkloadStatusAlertRule(t *testing.T) {
156157 Type : intstr .String ,
157158 StrVal : fmt .Sprintf ("kube_deployment_status_replicas{deployment=\" %s\" , namespace=\" %s\" } != kube_deployment_status_replicas_ready{deployment=\" %s\" , namespace=\" %s\" } " , fmt .Sprintf (test .argocd .Name + "-redis" ), test .argocd .Namespace , fmt .Sprintf (test .argocd .Name + "-redis" ), test .argocd .Namespace ),
158159 },
159- For : "5m" ,
160+ For : ptr . To (( monitoringv1 . Duration )( "5m" )) ,
160161 Labels : map [string ]string {
161162 "severity" : "warning" ,
162163 },
0 commit comments