File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed
apps/HttpClients/src/smokeTest/java/com/microsoft/applicationinsights/smoketest
framework/src/main/java/com/microsoft/applicationinsights/smoketest Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ private static void verify(String successUrlWithQueryString) throws Exception {
8686 request
8787 .hasSuccess (true )
8888 .hasProperty ("_MS.ProcessedByMetricExtractors" , "True" )
89- .hasNoParent ())
89+ .hasNoParent ()
90+ .hasNoSampleRate ())
9091 .hasDependencySatisying (
9192 dependency ->
9293 dependency
@@ -97,7 +98,8 @@ private static void verify(String successUrlWithQueryString) throws Exception {
9798 .hasResultCode ("200" )
9899 .hasSuccess (true )
99100 .hasProperty ("_MS.ProcessedByMetricExtractors" , "True" )
100- .hasParent (trace .getRequestId (0 )))
101+ .hasParent (trace .getRequestId (0 ))
102+ .hasNoSampleRate ())
101103 .hasDependencySatisying (
102104 dependency ->
103105 dependency
@@ -108,7 +110,8 @@ private static void verify(String successUrlWithQueryString) throws Exception {
108110 .hasResultCode ("404" )
109111 .hasSuccess (false )
110112 .hasProperty ("_MS.ProcessedByMetricExtractors" , "True" )
111- .hasParent (trace .getRequestId (0 )))
113+ .hasParent (trace .getRequestId (0 ))
114+ .hasNoSampleRate ())
112115 .hasDependencySatisying (
113116 dependency ->
114117 dependency
@@ -119,7 +122,8 @@ private static void verify(String successUrlWithQueryString) throws Exception {
119122 .hasResultCode ("500" )
120123 .hasSuccess (false )
121124 .hasProperty ("_MS.ProcessedByMetricExtractors" , "True" )
122- .hasParent (trace .getRequestId (0 ))));
125+ .hasParent (trace .getRequestId (0 ))
126+ .hasNoSampleRate ()));
123127 }
124128
125129 @ Environment (TOMCAT_8_JAVA_8 )
Original file line number Diff line number Diff line change @@ -87,6 +87,20 @@ public DependencyAssert hasResultCode(String resultCode) {
8787 return this ;
8888 }
8989
90+ @ CanIgnoreReturnValue
91+ public DependencyAssert hasSampleRate (Float expectedSampleRate ) {
92+ isNotNull ();
93+ assertThat (actual .getSampleRate ()).isEqualTo (expectedSampleRate );
94+ return this ;
95+ }
96+
97+ @ CanIgnoreReturnValue
98+ public DependencyAssert hasNoSampleRate () {
99+ isNotNull ();
100+ assertThat (actual .getSampleRate ()).isNull ();
101+ return this ;
102+ }
103+
90104 private RemoteDependencyData getDependencyData () {
91105 Data <?> data = (Data <?>) actual .getData ();
92106 return (RemoteDependencyData ) data .getBaseData ();
Original file line number Diff line number Diff line change @@ -58,6 +58,20 @@ public RequestAssert hasParent(String parentId) {
5858 return this ;
5959 }
6060
61+ @ CanIgnoreReturnValue
62+ public RequestAssert hasSampleRate (Float expectedSampleRate ) {
63+ isNotNull ();
64+ assertThat (actual .getSampleRate ()).isEqualTo (expectedSampleRate );
65+ return this ;
66+ }
67+
68+ @ CanIgnoreReturnValue
69+ public RequestAssert hasNoSampleRate () {
70+ isNotNull ();
71+ assertThat (actual .getSampleRate ()).isNull ();
72+ return this ;
73+ }
74+
6175 private RequestData getRequestData () {
6276 Data <?> data = (Data <?>) actual .getData ();
6377 return (RequestData ) data .getBaseData ();
You can’t perform that action at this time.
0 commit comments