File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
google-cloud-spanner/src/test/java/com/google/cloud/spanner/it Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 2424import com .google .cloud .spanner .*;
2525import com .google .cloud .spanner .testing .EmulatorSpannerHelper ;
2626import com .google .common .base .Stopwatch ;
27+ import com .google .common .base .Strings ;
28+ import com .google .common .truth .IntegerSubject ;
2729import com .google .monitoring .v3 .ListTimeSeriesRequest ;
2830import com .google .monitoring .v3 .ListTimeSeriesResponse ;
2931import com .google .monitoring .v3 .ProjectName ;
@@ -132,14 +134,24 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
132134 // disabled.
133135 // Keeping this check to enable this check in the future.
134136 if (metric .equals ("afe_latencies" )) {
135- assertWithMessage ("Metric " + metric + " returned data." )
136- .that (response .getTimeSeriesCount ())
137- .isEqualTo (0 );
137+ IntegerSubject subject = assertWithMessage ("Metric " + metric + " returned data." )
138+ .that (response .getTimeSeriesCount ());
139+ if (isProduction ()) {
140+ subject .isEqualTo (0 );
141+ } else {
142+ subject .isGreaterThan (0 );
143+ }
144+
138145 } else {
139146 assertWithMessage ("Metric " + metric + " didn't return any data." )
140147 .that (response .getTimeSeriesCount ())
141148 .isGreaterThan (0 );
142149 }
143150 }
144151 }
152+
153+ private boolean isProduction () {
154+ String jobType = System .getenv ("JOB_TYPE" );
155+ return !Strings .isNullOrEmpty (jobType ) && !(jobType .contains ("devel" ) || jobType .contains ("staging" ));
156+ }
145157}
You can’t perform that action at this time.
0 commit comments