Skip to content

Commit

Permalink
Test ingestion sampling override
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed May 21, 2024
1 parent ee30a44 commit e7686f2
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.TOMCAT_8_JAVA_8_OPENJ9;
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.WILDFLY_13_JAVA_8;
import static com.microsoft.applicationinsights.smoketest.EnvironmentValue.WILDFLY_13_JAVA_8_OPENJ9;
import static org.assertj.core.api.Assertions.assertThat;

import com.microsoft.applicationinsights.smoketest.schemav2.Envelope;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import java.util.List;

@UseAgent("applicationinsights2.json")
abstract class SamplingOverrides2Test {
Expand All @@ -23,8 +26,17 @@ abstract class SamplingOverrides2Test {
@Test
@TargetUri(value = "/login", callCount = 100)
void testSampling() throws Exception {
testing.mockedIngestion.waitForItems("RequestData", 100);
testing.mockedIngestion.waitForItems("RemoteDependencyData", 100);
List<Envelope> rdList = testing.mockedIngestion.waitForItems("RequestData", 100);
List<Envelope> rddList = testing.mockedIngestion.waitForItems("RemoteDependencyData", 100);

for (Envelope rd : rdList) {
// ensure that ingestion sampling is overridden
assertThat(rd.getSampleRate()).isEqualTo(100);
}
for (Envelope rd : rddList) {
// ensure that ingestion sampling is overridden
assertThat(rd.getSampleRate()).isEqualTo(100);
}
}

@Environment(TOMCAT_8_JAVA_8)
Expand Down

0 comments on commit e7686f2

Please sign in to comment.