You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by al...@apache.org on 2020/08/21 15:59:29 UTC

[skywalking-agent-test-tool] branch bug-fix created (now c111fc0)

This is an automated email from the ASF dual-hosted git repository.

alonelaval pushed a change to branch bug-fix
in repository https://gitbox.apache.org/repos/asf/skywalking-agent-test-tool.git.


      at c111fc0  fix bug

This branch includes the following new commits:

     new c111fc0  fix bug

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-agent-test-tool] 01/01: fix bug

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alonelaval pushed a commit to branch bug-fix
in repository https://gitbox.apache.org/repos/asf/skywalking-agent-test-tool.git

commit c111fc08fb7736520b74dbb806382ce19afe3f56
Author: huawei <hu...@bit-s.cn>
AuthorDate: Fri Aug 21 23:57:35 2020 +0800

    fix bug
---
 .../test/agent/tool/validator/assertor/SegmentAssert.java      | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java b/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java
index be7ebe1..1db06fd 100644
--- a/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java
+++ b/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/validator/assertor/SegmentAssert.java
@@ -18,7 +18,9 @@
 package org.apache.skywalking.plugin.test.agent.tool.validator.assertor;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import org.apache.skywalking.plugin.test.agent.tool.validator.assertor.exception.ActualSegmentRefIsEmptyException;
 import org.apache.skywalking.plugin.test.agent.tool.validator.assertor.exception.KeyValueNotEqualsException;
 import org.apache.skywalking.plugin.test.agent.tool.validator.assertor.exception.LogEventKeyNotEqualsException;
@@ -48,18 +50,20 @@ public class SegmentAssert {
         if (expected.segments() == null) {
             return;
         }
+        Set<Segment> exist = new HashSet<>();
 
         for (Segment segment : expected.segments()) {
-            Segment actualSegment = findSegment(actual, segment);
+            Segment actualSegment = findSegment(actual, segment,exist);
             segment.setSegmentId(actualSegment.segmentId());
         }
     }
 
-    private static Segment findSegment(SegmentItem actual, Segment expectedSegment) {
+    private static Segment findSegment(SegmentItem actual, Segment expectedSegment,Set<Segment> exist ) {
         List<SegmentPredictionFailedCause> exceptions = new ArrayList<>();
         for (Segment actualSegment : actual.segments()) {
             try {
-                if (spansEquals(expectedSegment.spans(), actualSegment.spans())) {
+                if (spansEquals(expectedSegment.spans(), actualSegment.spans()) && !exist.contains(actualSegment)) {
+                    exist.add(actualSegment);
                     return actualSegment;
                 }
             } catch (SpanSizeNotEqualsException e) {