Skip to content

Commit

Permalink
Add a test for InProc dependency (#2905)
Browse files Browse the repository at this point in the history
  • Loading branch information
heyams authored Feb 22, 2023
1 parent 8d34a55 commit 0e6f725
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@

package com.microsoft.applicationinsights.smoketestapp;

import java.time.Instant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

@Autowired private TaskScheduler taskScheduler;

@GetMapping("/")
public String root() {
return "OK";
Expand All @@ -18,4 +23,10 @@ public String root() {
public String scheduler() {
return "OK!";
}

@GetMapping("/should-ignore")
public String shouldIgnoreTest() throws Exception {
taskScheduler.schedule(() -> System.out.println("here i am"), Instant.now());
return "OK!";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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.Data;
import com.microsoft.applicationinsights.smoketest.schemav2.Envelope;
Expand All @@ -24,7 +25,19 @@
@UseAgent
abstract class SpringSchedulingTest {

@RegisterExtension static final SmokeTestExtension testing = SmokeTestExtension.create();
@RegisterExtension
static final SmokeTestExtension testing =
SmokeTestExtension.builder()
.setSelfDiagnosticsLevel("debug")
.build(); // SmokeTestExtension.create();

@Test
@TargetUri("/should-ignore")
void shouldIgnoreTest() throws Exception {
// sleep a bit to make sure no dependencies are reported
Thread.sleep(5000);
assertThat(testing.mockedIngestion.getCountForType("RemoteDependencyData")).isZero();
}

@Test
@TargetUri("/scheduler")
Expand Down

0 comments on commit 0e6f725

Please sign in to comment.