File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
google-cloud-spanner/src/test/java/com/google/cloud/spanner/it Expand file tree Collapse file tree 1 file changed +17
-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,26 @@ 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 =
138+ assertWithMessage ("Metric " + metric + " returned data." )
139+ .that (response .getTimeSeriesCount ());
140+ if (isProduction ()) {
141+ subject .isEqualTo (0 );
142+ } else {
143+ subject .isGreaterThan (0 );
144+ }
145+
138146 } else {
139147 assertWithMessage ("Metric " + metric + " didn't return any data." )
140148 .that (response .getTimeSeriesCount ())
141149 .isGreaterThan (0 );
142150 }
143151 }
144152 }
153+
154+ private boolean isProduction () {
155+ String jobType = System .getenv ("JOB_TYPE" );
156+ return !Strings .isNullOrEmpty (jobType )
157+ && !(jobType .contains ("devel" ) || jobType .contains ("staging" ));
158+ }
145159}
You can’t perform that action at this time.
0 commit comments