Skip to content

Commit ec02fb5

Browse files
authored
Improve test error report (#11664)
1 parent 866e8e8 commit ec02fb5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

smoke-tests-otel-starter/spring-boot-common/src/main/java/io/opentelemetry/spring/smoketest/AbstractOtelSpringStarterSmokeTest.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.opentelemetry.semconv.incubating.DbIncubatingAttributes;
2727
import io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes;
2828
import java.util.Collections;
29+
import java.util.List;
2930
import org.assertj.core.api.AbstractCharSequenceAssert;
3031
import org.assertj.core.api.AbstractIterableAssert;
3132
import org.junit.jupiter.api.MethodOrderer;
@@ -165,7 +166,9 @@ void shouldSendTelemetry() {
165166
AbstractIterableAssert::isNotEmpty);
166167

167168
// Log
168-
LogRecordData firstLog = testing.getExportedLogRecords().get(0);
169+
List<LogRecordData> exportedLogRecords = testing.getExportedLogRecords();
170+
assertThat(exportedLogRecords).as("No log record exported.").isNotEmpty();
171+
LogRecordData firstLog = exportedLogRecords.get(0);
169172
assertThat(firstLog.getBody().asString())
170173
.as("Should instrument logs")
171174
.startsWith("Starting ")

0 commit comments

Comments
 (0)