File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
monitoring/api/v3/api-client Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -83,14 +83,15 @@ def test_custom_metric(client, custom_metric):
8383 # Use a constant seed so psuedo random number is known ahead of time
8484 random .seed (1 )
8585 pseudo_random_value = random .randint (0 , 10 )
86- # Reseed it
87- random .seed (1 )
8886
8987 INSTANCE_ID = "test_instance"
9088
9189 # It's rare, but write can fail with HttpError 500, so we retry.
9290 @backoff .on_exception (backoff .expo , HttpError , max_time = 120 )
9391 def write_value ():
92+ # Reseed it to make sure the sample code will pick the same
93+ # value.
94+ random .seed (1 )
9495 write_timeseries_value (client , PROJECT_RESOURCE ,
9596 METRIC_RESOURCE , INSTANCE_ID ,
9697 METRIC_KIND )
@@ -108,6 +109,6 @@ def eventually_consistent_test():
108109 value = int (
109110 response ['timeSeries' ][0 ]['points' ][0 ]['value' ]['int64Value' ])
110111 # using seed of 1 will create a value of 1
111- assert value == pseudo_random_value
112+ assert pseudo_random_value == value
112113
113114 eventually_consistent_test ()
You can’t perform that action at this time.
0 commit comments