Skip to content

Commit 04b5692

Browse files
committed
Use random log messages in PprofLogDataExporterTest.
1 parent 8022d75 commit 04b5692

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

profiler/src/test/java/com/splunk/opentelemetry/profiler/exporter/PprofLogDataExporterTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.splunk.opentelemetry.profiler.ProfilingDataType;
2525
import io.opentelemetry.api.common.Value;
2626
import java.nio.charset.StandardCharsets;
27+
import net.bytebuddy.utility.RandomString;
2728
import org.junit.jupiter.api.Test;
2829
import org.junit.jupiter.api.extension.RegisterExtension;
2930
import org.junit.jupiter.params.ParameterizedTest;
@@ -35,7 +36,7 @@ class PprofLogDataExporterTest {
3536

3637
@Test
3738
void emitDataToOpenTelemetryLogger() {
38-
var logMessage = "this is a test log message, the contents are not important.";
39+
var logMessage = RandomString.make();
3940

4041
var exporter =
4142
new PprofLogDataExporter(logger, ProfilingDataType.CPU, InstrumentationSource.CONTINUOUS);
@@ -46,7 +47,7 @@ void emitDataToOpenTelemetryLogger() {
4647

4748
@Test
4849
void expectedNumberOfLogMessageAttributesAreIncluded() {
49-
var logMessage = "this is a test log message, the contents are not important.";
50+
var logMessage = RandomString.make();
5051

5152
var exporter =
5253
new PprofLogDataExporter(logger, ProfilingDataType.CPU, InstrumentationSource.CONTINUOUS);
@@ -58,7 +59,7 @@ void expectedNumberOfLogMessageAttributesAreIncluded() {
5859

5960
@Test
6061
void includeSplunkSourceTypeAttributeInLogMessage() {
61-
var logMessage = "this is a test log message, the contents are not important.";
62+
var logMessage = RandomString.make();
6263

6364
var exporter =
6465
new PprofLogDataExporter(logger, ProfilingDataType.CPU, InstrumentationSource.CONTINUOUS);
@@ -70,7 +71,7 @@ void includeSplunkSourceTypeAttributeInLogMessage() {
7071

7172
@Test
7273
void includeProfilingDataFormatAttributeInLogMessage() {
73-
var logMessage = "this is a test log message, the contents are not important.";
74+
var logMessage = RandomString.make();
7475

7576
var exporter =
7677
new PprofLogDataExporter(logger, ProfilingDataType.CPU, InstrumentationSource.CONTINUOUS);
@@ -83,7 +84,7 @@ void includeProfilingDataFormatAttributeInLogMessage() {
8384
@ParameterizedTest
8485
@EnumSource(ProfilingDataType.class)
8586
void includeProfilingDataTypeAttributeInLogMessage(ProfilingDataType dataType) {
86-
var logMessage = "this is a test log message, the contents are not important.";
87+
var logMessage = RandomString.make();
8788

8889
var exporter = new PprofLogDataExporter(logger, dataType, InstrumentationSource.CONTINUOUS);
8990
exporter.export(logMessage.getBytes(StandardCharsets.UTF_8), 1);
@@ -95,7 +96,7 @@ void includeProfilingDataTypeAttributeInLogMessage(ProfilingDataType dataType) {
9596
@ParameterizedTest
9697
@EnumSource(InstrumentationSource.class)
9798
void includeProfilingInstrumentationSourceAttributeInLogMessage(InstrumentationSource source) {
98-
var logMessage = "this is a test log message, the contents are not important.";
99+
var logMessage = RandomString.make();
99100

100101
var exporter = new PprofLogDataExporter(logger, ProfilingDataType.CPU, source);
101102
exporter.export(logMessage.getBytes(StandardCharsets.UTF_8), 1);
@@ -107,7 +108,7 @@ void includeProfilingInstrumentationSourceAttributeInLogMessage(InstrumentationS
107108
@ParameterizedTest
108109
@ValueSource(ints = {1, 50, 100, 10_000})
109110
void includeFrameCountAttributeInLogMessage(int frameCount) {
110-
var logMessage = "this is a test log message, the contents are not important.";
111+
var logMessage = RandomString.make();
111112

112113
var exporter =
113114
new PprofLogDataExporter(logger, ProfilingDataType.CPU, InstrumentationSource.CONTINUOUS);

0 commit comments

Comments
 (0)