You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/08/22 03:12:01 UTC
[skywalking-agent-test-tool] branch master updated: fix bug (#22)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-agent-test-tool.git
The following commit(s) were added to refs/heads/master by this push:
new 8a48c49 fix bug (#22)
8a48c49 is described below
commit 8a48c49b4420df5c9576d2aea178b2ebcb7ecd09
Author: huawei <al...@gmail.com>
AuthorDate: Sat Aug 22 11:11:55 2020 +0800
fix bug (#22)
* fix bug
* fix code style
Co-authored-by: huawei <hu...@bit-s.cn>
---
.../test/agent/tool/validator/assertor/SegmentAssert.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 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..8d45b2c 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,19 @@ 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) {