File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
smoke-tests/apps/SpringScheduling/src
main/java/com/microsoft/applicationinsights/smoketestapp
smokeTest/java/com/microsoft/applicationinsights/smoketest Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 33
44package com .microsoft .applicationinsights .smoketestapp ;
55
6+ import java .time .Instant ;
7+ import org .springframework .beans .factory .annotation .Autowired ;
8+ import org .springframework .scheduling .TaskScheduler ;
69import org .springframework .web .bind .annotation .GetMapping ;
710import org .springframework .web .bind .annotation .RestController ;
811
912@ RestController
1013public class TestController {
1114
15+ @ Autowired private TaskScheduler taskScheduler ;
16+
1217 @ GetMapping ("/" )
1318 public String root () {
1419 return "OK" ;
@@ -18,4 +23,10 @@ public String root() {
1823 public String scheduler () {
1924 return "OK!" ;
2025 }
26+
27+ @ GetMapping ("/should-ignore" )
28+ public String shouldIgnoreTest () throws Exception {
29+ taskScheduler .schedule (() -> System .out .println ("here i am" ), Instant .now ());
30+ return "OK!" ;
31+ }
2132}
Original file line number Diff line number Diff line change 1212import static com .microsoft .applicationinsights .smoketest .EnvironmentValue .TOMCAT_8_JAVA_8_OPENJ9 ;
1313import static com .microsoft .applicationinsights .smoketest .EnvironmentValue .WILDFLY_13_JAVA_8 ;
1414import static com .microsoft .applicationinsights .smoketest .EnvironmentValue .WILDFLY_13_JAVA_8_OPENJ9 ;
15+ import static org .assertj .core .api .Assertions .assertThat ;
1516
1617import com .microsoft .applicationinsights .smoketest .schemav2 .Data ;
1718import com .microsoft .applicationinsights .smoketest .schemav2 .Envelope ;
2425@ UseAgent
2526abstract class SpringSchedulingTest {
2627
27- @ RegisterExtension static final SmokeTestExtension testing = SmokeTestExtension .create ();
28+ @ RegisterExtension
29+ static final SmokeTestExtension testing =
30+ SmokeTestExtension .builder ()
31+ .setSelfDiagnosticsLevel ("debug" )
32+ .build (); // SmokeTestExtension.create();
33+
34+ @ Test
35+ @ TargetUri ("/should-ignore" )
36+ void shouldIgnoreTest () throws Exception {
37+ // sleep a bit to make sure no dependencies are reported
38+ Thread .sleep (5000 );
39+ assertThat (testing .mockedIngestion .getCountForType ("RemoteDependencyData" )).isZero ();
40+ }
2841
2942 @ Test
3043 @ TargetUri ("/scheduler" )
You can’t perform that action at this time.
0 commit comments