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):
83
83
# Use a constant seed so psuedo random number is known ahead of time
84
84
random .seed (1 )
85
85
pseudo_random_value = random .randint (0 , 10 )
86
- # Reseed it
87
- random .seed (1 )
88
86
89
87
INSTANCE_ID = "test_instance"
90
88
91
89
# It's rare, but write can fail with HttpError 500, so we retry.
92
90
@backoff .on_exception (backoff .expo , HttpError , max_time = 120 )
93
91
def write_value ():
92
+ # Reseed it to make sure the sample code will pick the same
93
+ # value.
94
+ random .seed (1 )
94
95
write_timeseries_value (client , PROJECT_RESOURCE ,
95
96
METRIC_RESOURCE , INSTANCE_ID ,
96
97
METRIC_KIND )
@@ -108,6 +109,6 @@ def eventually_consistent_test():
108
109
value = int (
109
110
response ['timeSeries' ][0 ]['points' ][0 ]['value' ]['int64Value' ])
110
111
# using seed of 1 will create a value of 1
111
- assert value == pseudo_random_value
112
+ assert pseudo_random_value == value
112
113
113
114
eventually_consistent_test ()
You can’t perform that action at this time.
0 commit comments