@@ -39,4 +39,31 @@ func TestMetricsInitialization(t *testing.T) {
39
39
assert .NotNil (t , cpm .kubeAPIRequestsTotal )
40
40
assert .NotNil (t , cpm .kubeAPIRequestsErrorsTotal )
41
41
})
42
+
43
+ t .Run ("NewApplicationsMetrics" , func (t * testing.T ) {
44
+ apm := NewApplicationsMetrics ()
45
+ assert .NotNil (t , apm )
46
+ assert .NotNil (t , apm .applicationsTotal )
47
+ assert .NotNil (t , apm .imagesWatchedTotal )
48
+ assert .NotNil (t , apm .imagesUpdatedTotal )
49
+ assert .NotNil (t , apm .imagesUpdatedErrorsTotal )
50
+ })
51
+ }
52
+
53
+ func TestMetricsOperations (t * testing.T ) {
54
+ epm := Endpoint ()
55
+ epm .IncreaseRequest ("/registry1" , false )
56
+ epm .IncreaseRequest ("/registry1" , true )
57
+
58
+ cpm := Clients ()
59
+ cpm .IncreaseArgoCDClientRequest ("server1" , 1 )
60
+ cpm .IncreaseArgoCDClientError ("server1" , 2 )
61
+ cpm .IncreaseK8sClientRequest (3 )
62
+ cpm .IncreaseK8sClientError (4 )
63
+
64
+ apm := Applications ()
65
+ apm .IncreaseImageUpdate ("app1" , 1 )
66
+ apm .IncreaseUpdateErrors ("app1" , 2 )
67
+ apm .SetNumberOfApplications (3 )
68
+ apm .SetNumberOfImagesWatched ("app1" , 4 )
42
69
}
0 commit comments