Skip to content

Commit f30c84f

Browse files
committed
Merge branch 'main' into PR #3928 to update
2 parents ca7582c + 710099e commit f30c84f

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITBuiltInMetricsTest.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import com.google.cloud.spanner.*;
2525
import com.google.cloud.spanner.testing.EmulatorSpannerHelper;
2626
import com.google.common.base.Stopwatch;
27+
import com.google.common.base.Strings;
28+
import com.google.common.truth.IntegerSubject;
2729
import com.google.monitoring.v3.ListTimeSeriesRequest;
2830
import com.google.monitoring.v3.ListTimeSeriesResponse;
2931
import com.google.monitoring.v3.ProjectName;
@@ -132,14 +134,25 @@ 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 (isAfeMetricEnabled()) {
141+
subject.isGreaterThan(0);
142+
} else {
143+
subject.isEqualTo(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 isAfeMetricEnabled() {
155+
String jobType = System.getenv("JOB_TYPE");
156+
return !Strings.isNullOrEmpty(jobType) && jobType.contains("devel");
157+
}
145158
}

0 commit comments

Comments
 (0)