@@ -259,7 +259,7 @@ func TestVerificationRequiredMetric(t *testing.T) {
259259 memberAwait := awaitilities .Member1 ()
260260 memberAwait2 := awaitilities .Member2 ()
261261 route := hostAwait .RegistrationServiceURL
262- hostAwait .UpdateToolchainConfig (t , testconfig .AutomaticApproval ().Enabled (false )) // disable automatic approval so that users are created with verification required
262+ hostAwait .UpdateToolchainConfig (t , testconfig .AutomaticApproval ().Enabled (true ))
263263 // host metrics should be available at this point
264264 hostAwait .InitMetrics (t , awaitilities .Member1 ().ClusterName , awaitilities .Member2 ().ClusterName )
265265 t .Cleanup (func () {
@@ -312,8 +312,17 @@ func TestVerificationRequiredMetric(t *testing.T) {
312312 require .NotEmpty (t , verificationCode )
313313 // Attempt to verify with an incorrect verification code
314314 NewHTTPRequest (t ).InvokeEndpoint ("GET" , route + "/api/v1/signup/verification/invalid" , token0 , "" , http .StatusForbidden )
315- hostAwait .WaitForMetricDelta (t , wait .UserSignupVerificationRequiredMetric , 1 ) // no change after verification initiated
316- hostAwait .WaitForHistogramInfBucketDelta (t , wait .SignupProvisionTimeMetric , 0 ) // no tracking of provision time for users with phone verification step
315+ // verify with the correct code
316+ NewHTTPRequest (t ).InvokeEndpoint ("GET" , route + fmt .Sprintf ("/api/v1/signup/verification/%s" , verificationCode ), token0 , "" , http .StatusOK )
317+ hostAwait .WaitForMetricDelta (t , wait .UserSignupVerificationRequiredMetric , 1 ) // no change after verification initiated
318+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsMetric , 1 ) // user provisioned
319+ hostAwait .WaitForMetricDelta (t , wait .UsersPerActivationsAndDomainMetric , 0 , "activations" , "1" , "domain" , "internal" ) // never incremented
320+ hostAwait .WaitForMetricDelta (t , wait .UsersPerActivationsAndDomainMetric , 1 , "activations" , "1" , "domain" , "external" ) // user activated
321+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsApprovedMetric , 1 ) // user approved
322+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsApprovedWithMethodMetric , 1 , "method" , "automatic" ) // user automatically approved
323+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsApprovedWithMethodMetric , 0 , "method" , "manual" ) // not manually approved
324+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsDeactivatedMetric , 0 ) // not deactivated
325+ hostAwait .WaitForHistogramInfBucketDelta (t , wait .SignupProvisionTimeMetric , 0 ) // no tracking of provision time for users with phone verification step
317326 })
318327
319328 t .Run ("no change to metric when user deactivated" , func (t * testing.T ) {
@@ -331,6 +340,7 @@ func TestVerificationRequiredMetric(t *testing.T) {
331340 err = hostAwait .WaitUntilSpaceAndSpaceBindingsDeleted (t , username )
332341 require .NoError (t , err )
333342 hostAwait .WaitForMetricDelta (t , wait .UserSignupVerificationRequiredMetric , 1 ) // no change
343+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsDeactivatedMetric , 1 ) // user deactivated
334344 })
335345
336346 t .Run ("metric incremented when user reactivated" , func (t * testing.T ) {
@@ -343,6 +353,15 @@ func TestVerificationRequiredMetric(t *testing.T) {
343353 // then
344354 require .NoError (t , err )
345355 hostAwait .WaitForMetricDelta (t , wait .UserSignupVerificationRequiredMetric , 2 ) // additional pending verification since user was reactivated
356+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsMetric , 2 ) // reactivated UserSignup
357+ // no other changes
358+ hostAwait .WaitForMetricDelta (t , wait .UsersPerActivationsAndDomainMetric , 0 , "activations" , "1" , "domain" , "internal" )
359+ hostAwait .WaitForMetricDelta (t , wait .UsersPerActivationsAndDomainMetric , 1 , "activations" , "1" , "domain" , "external" )
360+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsApprovedMetric , 1 )
361+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsApprovedWithMethodMetric , 1 , "method" , "automatic" )
362+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsApprovedWithMethodMetric , 0 , "method" , "manual" )
363+ hostAwait .WaitForMetricDelta (t , wait .UserSignupsDeactivatedMetric , 1 )
364+ hostAwait .WaitForHistogramInfBucketDelta (t , wait .SignupProvisionTimeMetric , 0 )
346365 })
347366 })
348367}
0 commit comments