@@ -32,31 +32,52 @@ func TestOperatorVersionMetrics(t *testing.T) {
3232 awaitilities := WaitForDeployments (t )
3333
3434 t .Run ("host-operator" , func (t * testing.T ) {
35+
3536 // given
3637 hostAwait := awaitilities .Host ()
37- // host metrics should be available at this point
38- hostAwait .InitMetrics (t , awaitilities .Member1 ().ClusterName , awaitilities .Member2 ().ClusterName )
3938
40- // when
41- labels := hostAwait .GetMetricLabels (t , wait .HostOperatorVersionMetric )
39+ t .Run ("commit" , func (t * testing.T ) {
40+ // when
41+ labels := hostAwait .GetMetricLabels (t , hostAwait .MetricsURL , wait .HostOperatorCommitMetric )
4242
43- // verify that the "version" metric exists for Host Operator and that it has a non-empty `commit` label
44- require .Len (t , labels , 1 )
45- commit := labels [0 ]["commit" ]
46- assert .Len (t , commit , 7 )
43+ // verify that the "version" metric exists for Host Operator and that it has a non-empty `commit` label
44+ require .Len (t , labels , 1 )
45+ commit := labels [0 ]["commit" ]
46+ assert .Len (t , commit , len ("e6a12a442a60dfd86d348a030ad2e789c79184b5" )) // example value: 40 characters
47+ })
48+
49+ t .Run ("short commit" , func (t * testing.T ) {
50+ // when
51+ labels := hostAwait .GetMetricLabels (t , hostAwait .MetricsURL , wait .HostOperatorShortCommitMetric )
52+
53+ // verify that the "version" metric exists for Host Operator and that it has a non-empty `commit` label
54+ require .Len (t , labels , 1 )
55+ commit := labels [0 ]["commit" ]
56+ assert .Len (t , commit , 7 )
57+ })
58+
59+ t .Run ("version" , func (t * testing.T ) {
60+ // when
61+ labels := hostAwait .GetMetricLabels (t , hostAwait .MetricsURL , wait .HostOperatorVersionMetric )
62+
63+ // verify that the "version" metric exists for Host Operator and that it has a non-empty `commit` label
64+ require .Len (t , labels , 1 )
65+ commit := labels [0 ]["commit" ]
66+ assert .Len (t , commit , 7 )
67+ })
4768 })
4869
4970 t .Run ("member-operators" , func (t * testing.T ) {
5071 // given
5172 member1Await := awaitilities .Member1 ()
52- member2Await := awaitilities .Member1 ()
73+ member2Await := awaitilities .Member2 ()
5374 // member metrics should be available at this point
5475 member1Await .InitMetrics (t )
5576 member2Await .InitMetrics (t )
5677
5778 // --- member1 ---
5879 // when
59- labels := member1Await .GetMetricLabels (t , wait .MemberOperatorVersionMetric )
80+ labels := member1Await .GetMetricLabels (t , member1Await . MetricsURL , wait .MemberOperatorVersionMetric )
6081
6182 // verify that the "version" metric exists for the first Member Operator and that it has a non-empty `commit` label
6283 require .Len (t , labels , 1 )
@@ -65,7 +86,7 @@ func TestOperatorVersionMetrics(t *testing.T) {
6586
6687 // --- member2 ---
6788 // when
68- labels = member2Await .GetMetricLabels (t , wait .MemberOperatorVersionMetric )
89+ labels = member2Await .GetMetricLabels (t , member2Await . MetricsURL , wait .MemberOperatorVersionMetric )
6990
7091 // verify that the "version" metric exists for the second Member Operator and that it has a non-empty `commit` label
7192 require .Len (t , labels , 1 )
@@ -75,6 +96,35 @@ func TestOperatorVersionMetrics(t *testing.T) {
7596 // expect the same version on member1 and member2
7697 assert .Equal (t , commit1 , commit2 )
7798 })
99+
100+ t .Run ("registration-service" , func (t * testing.T ) {
101+
102+ // given
103+ hostAwait := awaitilities .Host ()
104+ _ , err := hostAwait .WaitForRouteToBeAvailable (t , hostAwait .Namespace , "registration-service-metrics" , "/metrics" )
105+ require .NoError (t , err )
106+
107+ t .Run ("commit" , func (t * testing.T ) {
108+ // when
109+ labels := hostAwait .GetMetricLabels (t , hostAwait .RegistrationServiceMetricsURL , wait .RegistrationServiceCommitMetric )
110+
111+ // verify that the "version" metric exists for Host Operator and that it has a non-empty `commit` label
112+ require .Len (t , labels , 1 )
113+ commit := labels [0 ]["commit" ]
114+ assert .Len (t , commit , len ("da3f54634cc65075d51d067a157831d44bf1413e" )) // example value: 40 characters
115+ })
116+
117+ t .Run ("short commit" , func (t * testing.T ) {
118+ // when
119+ labels := hostAwait .GetMetricLabels (t , hostAwait .RegistrationServiceMetricsURL , wait .RegistrationServiceShortCommitMetric )
120+
121+ // verify that the "version" metric exists for Host Operator and that it has a non-empty `commit` label
122+ require .Len (t , labels , 1 )
123+ commit := labels [0 ]["commit" ]
124+ assert .Len (t , commit , 7 )
125+ })
126+ })
127+
78128}
79129
80130// TestMetricsWhenUsersManuallyApproved verifies that `UserSignupsApprovedMetric` and `UserSignupsApprovedWithMethodMetric` counters are increased when users are approved
0 commit comments