You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/10/18 01:46:52 UTC
[skywalking-java] branch main updated: add e2e test for kafka
transporter (#42)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git
The following commit(s) were added to refs/heads/main by this push:
new fbdfc42 add e2e test for kafka transporter (#42)
fbdfc42 is described below
commit fbdfc42b4d825ba33205d646ddaaaad20c005cb8
Author: Daming <zt...@foxmail.com>
AuthorDate: Mon Oct 18 09:46:16 2021 +0800
add e2e test for kafka transporter (#42)
---
.github/workflows/e2e.yaml | 18 ++-
apm-sniffer/config/agent.config | 2 +-
test/e2e/base/base-compose.yml | 9 +-
test/e2e/base/consumer/Dockerfile | 4 +
test/e2e/base/provider/Dockerfile | 4 +
test/e2e/case/base/e2e.yaml | 100 ----------------
test/e2e/case/base/expected/traces-list.yml | 47 --------
test/e2e/case/{base => }/expected/event-list.yml | 6 +-
test/e2e/case/{base => }/expected/logs-list.yml | 12 +-
.../case/{base => }/expected/metrics-has-value.yml | 0
.../case/{base => }/expected/service-endpoint.yml | 4 +-
.../case/{base => }/expected/service-instance.yml | 20 +---
test/e2e/case/{base => }/expected/service.yml | 0
.../case/{base => }/expected/trace-info-detail.yml | 54 +++------
.../{base => }/expected/trace-users-detail.yml | 8 +-
.../traces-list.yml} | 20 +++-
test/e2e/case/{base => grpc}/docker-compose.yml | 6 +-
test/e2e/case/grpc/e2e.yaml | 90 ++++++++++++++
test/e2e/case/kafka/docker-compose.yml | 129 +++++++++++++++++++++
test/e2e/case/kafka/e2e.yaml | 90 ++++++++++++++
.../expected/metrics-has-value.yml => script/env} | 7 +-
test/e2e/script/prepare/install-swctl.sh | 33 ++++++
test/e2e/script/prepare/install-yq.sh | 30 +++++
test/e2e/script/prepare/install.sh | 35 ++++++
24 files changed, 478 insertions(+), 250 deletions(-)
diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml
index 9ca28e9..21629de 100644
--- a/.github/workflows/e2e.yaml
+++ b/.github/workflows/e2e.yaml
@@ -23,8 +23,16 @@ on:
jobs:
E2E:
- name: Basic function + gRPC transport(Java8)
+ name: Basic function + ${{ matrix.case.name }} transport(Java8)
runs-on: ubuntu-latest
+ timeout-minutes: 90
+ strategy:
+ matrix:
+ case:
+ - name: gRPC
+ path: test/e2e/case/grpc/e2e.yaml
+ - name: Kafka
+ path: test/e2e/case/kafka/e2e.yaml
steps:
- uses: actions/checkout@v2
with:
@@ -42,7 +50,11 @@ jobs:
SW_VERSION=$(./mvnw -q -DforceStdout -N org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version)
./mvnw -B package -f ./test/e2e/base/pom.xml -Dsw.version=${SW_VERSION}
echo "::endgroup::"
+ - name: Setup go
+ uses: actions/setup-go@v2
+ with:
+ go-version: '1.16'
- name: Run E2E Tests
- uses: apache/skywalking-infra-e2e@7d55a252c35bf69f65dc64675a80699dc3c21bde
+ uses: apache/skywalking-infra-e2e@main
with:
- e2e-file: test/e2e/case/base/e2e.yaml
+ e2e-file: ${{ matrix.case.path }}
diff --git a/apm-sniffer/config/agent.config b/apm-sniffer/config/agent.config
index c8d10d7..d626014 100755
--- a/apm-sniffer/config/agent.config
+++ b/apm-sniffer/config/agent.config
@@ -245,7 +245,7 @@ plugin.kafka.topic_profiling=${SW_PLUGIN_KAFKA_TOPIC_PROFILINGS:skywalking-profi
# Specify which Kafka topic name for the register or heartbeat data of Service Instance to report to.
plugin.kafka.topic_management=${SW_PLUGIN_KAFKA_TOPIC_MANAGEMENT:skywalking-managements}
# Specify which Kafka topic name for the logging data to report to.
-plugin.kafka.topic_logging=${SW_PLUGIN_KAFKA_TOPIC_LOGGING:skywalking-logging}
+plugin.kafka.topic_logging=${SW_PLUGIN_KAFKA_TOPIC_LOGGING:skywalking-logs}
# isolate multi OAP server when using same Kafka cluster (final topic name will append namespace before Kafka topics with `-` ).
plugin.kafka.namespace=${SW_KAFKA_NAMESPACE:}
# Match spring beans with regular expression for the class name. Multiple expressions could be separated by a comma. This only works when `Spring annotation plugin` has been activated.
diff --git a/test/e2e/base/base-compose.yml b/test/e2e/base/base-compose.yml
index c492b9d..d8523b3 100644
--- a/test/e2e/base/base-compose.yml
+++ b/test/e2e/base/base-compose.yml
@@ -35,6 +35,8 @@ services:
build:
context: provider
dockerfile: Dockerfile
+ args:
+ ENABLE_KAFKA_REPORTER: "false"
expose:
- 9090
networks:
@@ -42,7 +44,7 @@ services:
environment:
SW_AGENT_NAME: e2e-service-provider
SW_AGENT_COLLECTOR_BACKEND_SERVICES: oap:11800
- SW_INSTANCE_NAME: provider1
+ SW_AGENT_INSTANCE_NAME: provider1
SW_LOGGING_OUTPUT: CONSOLE
healthcheck:
test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 9090"]
@@ -54,15 +56,16 @@ services:
build:
context: consumer
dockerfile: Dockerfile
+ args:
+ ENABLE_KAFKA_REPORTER: "false"
expose:
- 9090
networks:
- e2e
environment:
- PROVIDER_URL: http://provider:9090
SW_AGENT_COLLECTOR_BACKEND_SERVICES: oap:11800
SW_AGENT_NAME: e2e-service-consumer
- SW_INSTANCE_NAME: consumer1
+ SW_AGENT_INSTANCE_NAME: consumer1
SW_LOGGING_OUTPUT: CONSOLE
healthcheck:
test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 9090"]
diff --git a/test/e2e/base/consumer/Dockerfile b/test/e2e/base/consumer/Dockerfile
index 0a6b88b..a512311 100644
--- a/test/e2e/base/consumer/Dockerfile
+++ b/test/e2e/base/consumer/Dockerfile
@@ -15,6 +15,10 @@
FROM skywalking/skywalking-java:latest-java8
+ARG ENABLE_KAFKA_REPORTER
+
+RUN if [[ "${ENABLE_KAFKA_REPORTER}" == "true" ]]; then cp -rf /skywalking/agent/optional-reporter-plugins/* /skywalking/agent/plugins/ ; fi
+
VOLUME /services
ADD target/e2e-service-consumer.jar /services/
diff --git a/test/e2e/base/provider/Dockerfile b/test/e2e/base/provider/Dockerfile
index a7424cc..77acc42 100644
--- a/test/e2e/base/provider/Dockerfile
+++ b/test/e2e/base/provider/Dockerfile
@@ -15,6 +15,10 @@
FROM skywalking/skywalking-java:latest-java8
+ARG ENABLE_KAFKA_REPORTER
+
+RUN if [[ "${ENABLE_KAFKA_REPORTER}" == "true" ]]; then cp -rf /skywalking/agent/optional-reporter-plugins/* /skywalking/agent/plugins/ ; fi
+
VOLUME /services
ADD target/e2e-service-provider.jar /services/
diff --git a/test/e2e/case/base/e2e.yaml b/test/e2e/case/base/e2e.yaml
deleted file mode 100644
index 34aaff1..0000000
--- a/test/e2e/case/base/e2e.yaml
+++ /dev/null
@@ -1,100 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file is used to show how to write configuration files and can be used to test.
-
-setup:
- env: compose
- file: docker-compose.yml
- timeout: 1200
- steps:
- - name: install yq
- command: |
- if ! command -v yq &> /dev/null; then
- mkdir -p /tmp/skywalking-infra-e2e/bin && cd /tmp/skywalking-infra-e2e
- mkdir -p yq && cd yq
- curl -kLo yq.tar.gz https://github.com/mikefarah/yq/archive/v4.11.1.tar.gz
- tar -zxf yq.tar.gz --strip=1
- go install && go build -ldflags -s && mv yq ../bin/yq
- export PATH="$PATH:/tmp/skywalking-infra-e2e/bin"
- echo "success to install yq"
- fi
- - name: install swctl
- command: |
- if ! command -v swctl &> /dev/null; then
- mkdir -p /tmp/skywalking-infra-e2e/bin && cd /tmp/skywalking-infra-e2e
- mkdir -p swctl && cd swctl
- curl -kLo skywalking-cli.tar.gz https://github.com/apache/skywalking-cli/archive/4d1cb83e24ff58988f4aba0daa50259593b11670.tar.gz
- tar -zxf skywalking-cli.tar.gz --strip=1
- utype=$(uname | awk '{print tolower($0)}')
- make $utype && mv bin/swctl-*-$utype-amd64 ../bin/swctl
- export PATH="$PATH:/tmp/skywalking-infra-e2e/bin"
- echo "success to install swctl"
- fi
-
-cleanup:
- # always never success failure
- on: always
-
-trigger:
- action: http
- interval: 3s
- times: 5
- url: http://${consumer_host}:${consumer_9090}/info
- method: POST
-
-verify:
- # verify with retry strategy
- retry:
- # max retry count
- count: 20
- # the interval between two retries, in millisecond.
- interval: 10000
- cases:
- # basic check: service list
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- # basic check: service metrics
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name service_sla --service=e2e-service-provider |yq e 'to_entries' -
- expected: expected/metrics-has-value.yml
- # basic check: service endpoint
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint list --keyword=info --service-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls|grep -B 1 'provider'|yq e '.[0].id' -)
- expected: expected/service-endpoint.yml
- # basic check: service endpoint metrics
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint=POST:/info --service=e2e-service-provider |yq e 'to_entries' -
- expected: expected/metrics-has-value.yml
-
- # native management: service instance list
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance list --service-name=e2e-service-provider
- expected: expected/service-instance.yml
-
- # native jvm: service instance jvm metrics
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name instance_jvm_thread_live_count --instance=provider1 --service=e2e-service-provider |yq e 'to_entries' -
- expected: expected/metrics-has-value.yml
-
- # native tracing: trace segment list
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls
- expected: expected/traces-list.yml
- # native tracing: trace detail
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace $(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls|grep -A 5 'POST:/info'|tail -n1|awk -F ' ' '{print $2}')
- expected: expected/trace-info-detail.yml
-
- # native event: event list
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql event list --service=e2e-service-provider --instance=provider1
- expected: expected/event-list.yml
-
- # native log: logs list
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql logs list --service-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls|grep -B 1 'provider'|yq e '.[0].id' -) --trace-id=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls|grep -A 5 'POST:/info'|tail -n1|awk -F ' ' '{print $2}')
- expected: expected/logs-list.yml
diff --git a/test/e2e/case/base/expected/traces-list.yml b/test/e2e/case/base/expected/traces-list.yml
deleted file mode 100644
index 2785bad..0000000
--- a/test/e2e/case/base/expected/traces-list.yml
+++ /dev/null
@@ -1,47 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-traces:
-{{- range .traces }}
-- segmentid: {{ notEmpty .segmentid }}
- endpointnames:
- {{- if eq (index .endpointnames 0) "HikariCP/Connection/getConnection" }}
- - HikariCP/Connection/getConnection
- {{- end }}
- {{- if eq (index .endpointnames 0) "HikariCP/Connection/close" }}
- - HikariCP/Connection/close
- {{- end }}
- {{- if eq (index .endpointnames 0) "H2/JDBI/Statement/execute" }}
- - H2/JDBI/Statement/execute
- {{- end}}
- {{- if eq (index .endpointnames 0) "H2/JDBI/Statement/executeQuery" }}
- - H2/JDBI/Statement/executeQuery
- {{- end}}
- {{- if eq (index .endpointnames 0) "H2/JDBI/PreparedStatement/executeQuery" }}
- - H2/JDBI/PreparedStatement/executeQuery
- {{- end }}
- {{- if eq (index .endpointnames 0) "POST:/info" }}
- - POST:/info
- {{- end }}
- {{- if eq (index .endpointnames 0) "POST:/users" }}
- - POST:/users
- {{- end }}
- duration: {{ ge .duration 0 }}
- start: "{{ notEmpty .start}}"
- iserror: false
- traceids:
- - {{ (index .traceids 0) }}
-{{- end }}
-total: {{ gt .total 0 }}
diff --git a/test/e2e/case/base/expected/event-list.yml b/test/e2e/case/expected/event-list.yml
similarity index 91%
rename from test/e2e/case/base/expected/event-list.yml
rename to test/e2e/case/expected/event-list.yml
index 8c41d3d..e5a19bf 100644
--- a/test/e2e/case/base/expected/event-list.yml
+++ b/test/e2e/case/expected/event-list.yml
@@ -14,7 +14,7 @@
# limitations under the License.
events:
-{{- range .events }}
+{{- contains .events }}
- uuid: {{ notEmpty .uuid }}
source:
service: e2e-service-provider
@@ -24,12 +24,10 @@ events:
type: Normal
message: Start Java Application
parameters:
- {{- range .parameters }}
- {{- if eq .key "OPTS"}}
+ {{- contains .parameters }}
- key: OPTS
value: {{ notEmpty .value }}
{{- end }}
- {{- end }}
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
{{- end }}
diff --git a/test/e2e/case/base/expected/logs-list.yml b/test/e2e/case/expected/logs-list.yml
similarity index 86%
rename from test/e2e/case/base/expected/logs-list.yml
rename to test/e2e/case/expected/logs-list.yml
index 3294910..cb0aa04 100644
--- a/test/e2e/case/base/expected/logs-list.yml
+++ b/test/e2e/case/expected/logs-list.yml
@@ -14,7 +14,7 @@
# limitations under the License.
logs:
- {{- range .logs }}
+ {{- contains .logs }}
- servicename: e2e-service-provider
serviceid: {{ b64enc "e2e-service-provider" }}.1
serviceinstancename: provider1
@@ -27,19 +27,13 @@ logs:
content: |
{{ notEmpty .content }}
tags:
- {{- range .tags }}
- {{- if eq .key "level"}}
+ {{- contains .tags }}
- key: level
value: INFO
- {{- end }}
- {{- if eq .key "logger" }}
- key: logger
value: {{ notEmpty .value }}
- {{- end }}
- {{- if eq .key "thread" }}
- key: thread
value: {{ notEmpty .value }}
{{- end }}
- {{- end }}
- {{- end }}
+ {{- end }}
total: {{ gt .total 0 }}
\ No newline at end of file
diff --git a/test/e2e/case/base/expected/metrics-has-value.yml b/test/e2e/case/expected/metrics-has-value.yml
similarity index 100%
copy from test/e2e/case/base/expected/metrics-has-value.yml
copy to test/e2e/case/expected/metrics-has-value.yml
diff --git a/test/e2e/case/base/expected/service-endpoint.yml b/test/e2e/case/expected/service-endpoint.yml
similarity index 93%
rename from test/e2e/case/base/expected/service-endpoint.yml
rename to test/e2e/case/expected/service-endpoint.yml
index 30b1efb..53e7404 100644
--- a/test/e2e/case/base/expected/service-endpoint.yml
+++ b/test/e2e/case/expected/service-endpoint.yml
@@ -13,9 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- range .}}
-{{- if eq .name "POST:/info" }}
+{{- contains .}}
- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "POST:/info" }}
name: POST:/info
-{{- end}}
{{- end}}
\ No newline at end of file
diff --git a/test/e2e/case/base/expected/service-instance.yml b/test/e2e/case/expected/service-instance.yml
similarity index 77%
rename from test/e2e/case/base/expected/service-instance.yml
rename to test/e2e/case/expected/service-instance.yml
index ef74087..4fa45b3 100644
--- a/test/e2e/case/base/expected/service-instance.yml
+++ b/test/e2e/case/expected/service-instance.yml
@@ -15,40 +15,26 @@
# specific language governing permissions and limitations
# under the License.
-{{- range .}}
+{{- contains .}}
- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }}
name: {{ notEmpty .name }}
attributes:
- {{- range .attributes }}
- {{- if eq .name "OS Name" }}
+ {{- contains .attributes }}
- name: OS Name
value: Linux
- {{- end }}
- {{- if eq .name "hostname" }}
- name: hostname
value: {{ notEmpty .value }}
- {{- end }}
- {{- if eq .name "Process No." }}
- name: Process No.
value: "1"
- {{- end }}
- {{- if eq .name "Start Time" }}
- name: Start Time
value: {{ notEmpty .value }}
- {{- end }}
- {{- if eq .name "JVM Arguments" }}
- name: JVM Arguments
value: '{{ notEmpty .value }}'
- {{- end }}
- {{- if eq .name "Jar Dependencies" }}
- name: Jar Dependencies
value: '{{ notEmpty .value }}'
- {{- end }}
- {{- if eq .name "ipv4s" }}
- name: ipv4s
value: {{ notEmpty .value }}
- {{- end }}
- {{- end}}
+ {{- end }}
language: JAVA
instanceuuid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }}
{{- end}}
\ No newline at end of file
diff --git a/test/e2e/case/base/expected/service.yml b/test/e2e/case/expected/service.yml
similarity index 100%
rename from test/e2e/case/base/expected/service.yml
rename to test/e2e/case/expected/service.yml
diff --git a/test/e2e/case/base/expected/trace-info-detail.yml b/test/e2e/case/expected/trace-info-detail.yml
similarity index 54%
rename from test/e2e/case/base/expected/trace-info-detail.yml
rename to test/e2e/case/expected/trace-info-detail.yml
index 7ee3efd..980c634 100644
--- a/test/e2e/case/base/expected/trace-info-detail.yml
+++ b/test/e2e/case/expected/trace-info-detail.yml
@@ -14,60 +14,34 @@
# limitations under the License.
spans:
- {{- range .spans}}
+ {{- contains .spans}}
- traceid: {{ notEmpty .traceid }}
segmentid: {{ notEmpty .segmentid }}
spanid: {{ .spanid }}
parentspanid: {{ .parentspanid }}
refs:
- {{- if eq .servicecode "e2e-service-provider" }}
- {{- range .refs }}
- - traceid: {{ notEmpty .traceid }}
- parentsegmentid: {{ notEmpty .parentsegmentid }}
- parentspanid: 1
- type: CROSS_PROCESS
+ {{- contains .refs }}
+ - traceid: {{ notEmpty .traceid }}
+ parentsegmentid: {{ notEmpty .parentsegmentid }}
+ parentspanid: 1
+ type: CROSS_PROCESS
{{- end }}
- {{- end }}
- {{- if eq .servicecode "e2e-service-consumer" }}
- []
- {{- end }}
- servicecode: {{ notEmpty .servicecode }}
- serviceinstancename: {{ notEmpty .serviceinstancename }}
+ servicecode: "e2e-service-provider"
+ serviceinstancename: "provider1"
starttime: {{ gt .starttime 0 }}
endtime: {{ gt .endtime 0 }}
- endpointname:
- {{- if eq .type "Exit" }}
- /info
- {{- end }}
- {{- if eq .type "Entry" }}
- POST:/info
- {{- end }}
- type: {{ notEmpty .type }}
- peer:
- {{- if eq .type "Exit" }}
- provider:9090
- {{ else }}
- ""
- {{- end }}
- component:
- {{- if eq .type "Exit" }}
- SpringRestTemplate
- {{- end }}
- {{- if eq .type "Entry" }}
- Tomcat
- {{- end }}
+ endpointname: POST:/info
+ type: Entry
+ peer: ""
+ component: Tomcat
iserror: false
layer: Http
tags:
- {{- range .tags }}
- {{- if eq .key "http.method" }}
+ {{- contains .tags }}
- key: http.method
value: POST
- {{- end }}
- {{- if eq .key "url" }}
- key: url
value: {{ notEmpty .value }}
{{- end }}
- {{- end }}
logs: []
- {{- end }}
\ No newline at end of file
+ {{- end }}
diff --git a/test/e2e/case/base/expected/trace-users-detail.yml b/test/e2e/case/expected/trace-users-detail.yml
similarity index 89%
rename from test/e2e/case/base/expected/trace-users-detail.yml
rename to test/e2e/case/expected/trace-users-detail.yml
index b46479e..488b55d 100644
--- a/test/e2e/case/base/expected/trace-users-detail.yml
+++ b/test/e2e/case/expected/trace-users-detail.yml
@@ -14,7 +14,7 @@
# limitations under the License.
spans:
- {{- range .spans}}
+ {{- contains .spans}}
- traceid: {{ notEmpty .traceid }}
segmentid: {{ notEmpty .segmentid }}
spanid: 0
@@ -31,15 +31,11 @@ spans:
iserror: false
layer: Http
tags:
- {{- range .tags }}
- {{- if eq .key "http.method" }}
+ {{- contains .tags }}
- key: http.method
value: POST
- {{- end }}
- {{- if eq .key "url" }}
- key: url
value: {{ notEmpty .value }}
{{- end }}
- {{- end }}
logs: []
{{- end }}
\ No newline at end of file
diff --git a/test/e2e/case/base/expected/metrics-has-value.yml b/test/e2e/case/expected/traces-list.yml
similarity index 69%
copy from test/e2e/case/base/expected/metrics-has-value.yml
copy to test/e2e/case/expected/traces-list.yml
index 27ae47c..bed9551 100644
--- a/test/e2e/case/base/expected/metrics-has-value.yml
+++ b/test/e2e/case/expected/traces-list.yml
@@ -13,9 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- contains . }}
-- key: {{ notEmpty .key }}
- value: {{ ge .value 0 }}
-- key: {{ notEmpty .key }}
- value: {{ ge .value 1 }}
-{{- end }}
\ No newline at end of file
+traces:
+ {{- contains .traces }}
+ - segmentid: {{ notEmpty .segmentid }}
+ endpointnames:
+ {{- contains .endpointnames }}
+ - POST:/info
+ {{- end }}
+ duration: {{ ge .duration 0 }}
+ start: "{{ notEmpty .start}}"
+ iserror: false
+ traceids:
+ - {{ (index .traceids 0) }}
+ {{- end }}
+total: {{ gt .total 0 }}
diff --git a/test/e2e/case/base/docker-compose.yml b/test/e2e/case/grpc/docker-compose.yml
similarity index 88%
rename from test/e2e/case/base/docker-compose.yml
rename to test/e2e/case/grpc/docker-compose.yml
index 2e655e8..621587b 100644
--- a/test/e2e/case/base/docker-compose.yml
+++ b/test/e2e/case/grpc/docker-compose.yml
@@ -27,9 +27,6 @@ services:
extends:
file: ../../base/base-compose.yml
service: provider
- environment:
- SW_AGENT_INSTANCE_NAME: provider1
- SW_LOGGING_OUTPUT: CONSOLE
ports:
- 9090
depends_on:
@@ -41,8 +38,7 @@ services:
file: ../../base/base-compose.yml
service: consumer
environment:
- SW_AGENT_INSTANCE_NAME: consumer1
- SW_LOGGING_OUTPUT: CONSOLE
+ PROVIDER_URL: http://provider:9090
ports:
- 9090
depends_on:
diff --git a/test/e2e/case/grpc/e2e.yaml b/test/e2e/case/grpc/e2e.yaml
new file mode 100644
index 0000000..3d86190
--- /dev/null
+++ b/test/e2e/case/grpc/e2e.yaml
@@ -0,0 +1,90 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is used to show how to write configuration files and can be used to test.
+
+setup:
+ env: compose
+ file: docker-compose.yml
+ timeout: 1200
+ init-system-environment: ../../script/env
+ steps:
+ - name: install yq
+ command: bash test/e2e/script/prepare/install.sh yq
+ - name: install swctl
+ command: bash test/e2e/script/prepare/install.sh swctl
+
+cleanup:
+ # always never success failure
+ on: always
+
+trigger:
+ action: http
+ interval: 3s
+ times: 5
+ url: http://${consumer_host}:${consumer_9090}/info
+ method: POST
+
+verify:
+ # verify with retry strategy
+ retry:
+ # max retry count
+ count: 20
+ # the interval between two retries, in millisecond.
+ interval: 10s
+ cases:
+ # basic check: service list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
+ expected: ../expected/service.yml
+ # basic check: service metrics
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name service_sla --service-name=e2e-service-provider |yq e 'to_entries' -
+ expected: ../expected/metrics-has-value.yml
+ # basic check: service endpoint
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint list --keyword=info --service-name=e2e-service-provider
+ expected: ../expected/service-endpoint.yml
+ # basic check: service endpoint metrics
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint-name=POST:/info --service-name=e2e-service-provider |yq e 'to_entries' -
+ expected: ../expected/metrics-has-value.yml
+
+ # service instance list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance list --service-name=e2e-service-provider
+ expected: ../expected/service-instance.yml
+
+ # service instance jvm metrics
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name instance_jvm_thread_live_count --instance-name=provider1 --service-name=e2e-service-provider |yq e 'to_entries' -
+ expected: ../expected/metrics-has-value.yml
+
+ # trace segment list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls
+ expected: ../expected/traces-list.yml
+ # trace detail
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace $( \
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls \
+ | yq e '.traces | select(.[].endpointnames[0]=="POST:/info") | .[0].traceids[0]' - \
+ )
+ expected: ../expected/trace-info-detail.yml
+
+ # event list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql event list --service-name=e2e-service-provider --instance-name=provider1
+ expected: ../expected/event-list.yml
+
+ # logs list
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql logs list --service-name=e2e-service-provider --trace-id=$( \
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls \
+ | yq e '.traces | select(.[].endpointnames[0]=="POST:/info") | .[0].traceids[0]' -
+ )
+ expected: ../expected/logs-list.yml
diff --git a/test/e2e/case/kafka/docker-compose.yml b/test/e2e/case/kafka/docker-compose.yml
new file mode 100644
index 0000000..3760fd4
--- /dev/null
+++ b/test/e2e/case/kafka/docker-compose.yml
@@ -0,0 +1,129 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+version: '2.1'
+
+services:
+ zookeeper:
+ image: zookeeper:3.4
+ hostname: zookeeper
+ expose:
+ - 2181
+ networks:
+ - e2e
+ environment:
+ - ALLOW_ANONYMOUS_LOGIN=yes
+ healthcheck:
+ test: ["CMD", "sh", "-c", "nc -nz 127.0.0.1 2181"]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ broker-a:
+ image: bitnami/kafka:2.4.1
+ hostname: broker-a
+ expose:
+ - 9092
+ networks:
+ - e2e
+ environment:
+ - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
+ - KAFKA_BROKER_ID=10
+ - ALLOW_PLAINTEXT_LISTENER=yes
+ depends_on:
+ zookeeper:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "kafka-topics.sh", "--list", "--zookeeper", "zookeeper:2181"]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ broker-b:
+ image: bitnami/kafka:2.4.1
+ hostname: broker-b
+ expose:
+ - 9092
+ networks:
+ - e2e
+ environment:
+ - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
+ - KAFKA_BROKER_ID=24
+ - ALLOW_PLAINTEXT_LISTENER=yes
+ depends_on:
+ zookeeper:
+ condition: service_healthy
+ healthcheck:
+ test: ["CMD", "kafka-topics.sh", "--list", "--zookeeper", "zookeeper:2181"]
+ interval: 5s
+ timeout: 60s
+ retries: 12
+
+ oap:
+ extends:
+ file: ../../base/base-compose.yml
+ service: oap
+ environment:
+ SW_KAFKA_FETCHER: default
+ SW_KAFKA_FETCHER_ENABLE_NATIVE_PROTO_LOG: "true"
+ SW_KAFKA_FETCHER_SERVERS: broker-a:9092,broker-b:9092
+ SW_KAFKA_FETCHER_PARTITIONS: 2
+ SW_KAFKA_FETCHER_PARTITIONS_FACTOR: 1
+ ports:
+ - 12800
+ depends_on:
+ broker-a:
+ condition: service_healthy
+ broker-b:
+ condition: service_healthy
+
+ kafkaprovider:
+ extends:
+ file: ../../base/base-compose.yml
+ service: provider
+ build:
+ args:
+ ENABLE_KAFKA_REPORTER: "true"
+ environment:
+ SW_KAFKA_BOOTSTRAP_SERVERS: broker-a:9092,broker-b:9092
+ SW_GET_TOPIC_TIMEOUT: 60
+ SW_PLUGIN_KAFKA_TOPIC_LOGGING: skywalking-logs
+ ports:
+ - 9090
+ depends_on:
+ oap:
+ condition: service_healthy
+
+
+ kafkaconsumer:
+ extends:
+ file: ../../base/base-compose.yml
+ service: consumer
+ build:
+ args:
+ ENABLE_KAFKA_REPORTER: "true"
+ environment:
+ SW_KAFKA_BOOTSTRAP_SERVERS: broker-a:9092,broker-b:9092
+ SW_GET_TOPIC_TIMEOUT: 60
+ SW_PLUGIN_KAFKA_TOPIC_LOGGING: skywalking-logs
+ PROVIDER_URL: http://kafkaprovider:9090
+ ports:
+ - 9090
+ depends_on:
+ kafkaprovider:
+ condition: service_healthy
+
+networks:
+ e2e:
diff --git a/test/e2e/case/kafka/e2e.yaml b/test/e2e/case/kafka/e2e.yaml
new file mode 100644
index 0000000..159462a
--- /dev/null
+++ b/test/e2e/case/kafka/e2e.yaml
@@ -0,0 +1,90 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This file is used to show how to write configuration files and can be used to test.
+
+setup:
+ env: compose
+ file: docker-compose.yml
+ timeout: 1200
+ init-system-environment: ../../script/env
+ steps:
+ - name: install yq
+ command: bash test/e2e/script/prepare/install.sh yq
+ - name: install swctl
+ command: bash test/e2e/script/prepare/install.sh swctl
+
+cleanup:
+ # always never success failure
+ on: always
+
+trigger:
+ action: http
+ interval: 3s
+ times: 5
+ url: http://${kafkaconsumer_host}:${kafkaconsumer_9090}/info
+ method: POST
+
+verify:
+ # verify with retry strategy
+ retry:
+ # max retry count
+ count: 20
+ # the interval between two retries, in millisecond.
+ interval: 10s
+ cases:
+ # basic check: service list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
+ expected: ../expected/service.yml
+ # basic check: service metrics
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name service_sla --service-name=e2e-service-provider |yq e 'to_entries' -
+ expected: ../expected/metrics-has-value.yml
+ # basic check: service endpoint
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint list --keyword=info --service-name=e2e-service-provider
+ expected: ../expected/service-endpoint.yml
+ # basic check: service endpoint metrics
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint-name=POST:/info --service-name=e2e-service-provider |yq e 'to_entries' -
+ expected: ../expected/metrics-has-value.yml
+
+ # service instance list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance list --service-name=e2e-service-provider
+ expected: ../expected/service-instance.yml
+
+ # service instance jvm metrics
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name instance_jvm_thread_live_count --instance-name=provider1 --service-name=e2e-service-provider |yq e 'to_entries' -
+ expected: ../expected/metrics-has-value.yml
+
+ # trace segment list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls
+ expected: ../expected/traces-list.yml
+ # trace detail
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace $( \
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls \
+ | yq e '.traces | select(.[].endpointnames[0]=="POST:/info") | .[0].traceids[0]' - \
+ )
+ expected: ../expected/trace-info-detail.yml
+
+ # event list
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql event list --service-name=e2e-service-provider --instance-name=provider1
+ expected: ../expected/event-list.yml
+
+ # logs list
+ - query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql logs list --service-name=e2e-service-provider --trace-id=$( \
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls \
+ | yq e '.traces | select(.[].endpointnames[0]=="POST:/info") | .[0].traceids[0]' -
+ )
+ expected: ../expected/logs-list.yml
diff --git a/test/e2e/case/base/expected/metrics-has-value.yml b/test/e2e/script/env
similarity index 85%
rename from test/e2e/case/base/expected/metrics-has-value.yml
rename to test/e2e/script/env
index 27ae47c..e57ec37 100644
--- a/test/e2e/case/base/expected/metrics-has-value.yml
+++ b/test/e2e/script/env
@@ -13,9 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-{{- contains . }}
-- key: {{ notEmpty .key }}
- value: {{ ge .value 0 }}
-- key: {{ notEmpty .key }}
- value: {{ ge .value 1 }}
-{{- end }}
\ No newline at end of file
+SW_CTL_COMMIT=b90255132f916f53eb90955cc8a6445b03a4bec3
diff --git a/test/e2e/script/prepare/install-swctl.sh b/test/e2e/script/prepare/install-swctl.sh
new file mode 100644
index 0000000..587541f
--- /dev/null
+++ b/test/e2e/script/prepare/install-swctl.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+BASE_DIR=$1
+BIN_DIR=$2
+
+set -ex
+
+if ! command -v swctl &> /dev/null; then
+ mkdir -p $BASE_DIR/swctl && cd $BASE_DIR/swctl
+ curl -kLo skywalking-cli.tar.gz https://github.com/apache/skywalking-cli/archive/${SW_CTL_COMMIT}.tar.gz
+ tar -zxf skywalking-cli.tar.gz --strip=1
+ utype=$(uname | awk '{print tolower($0)}')
+ make $utype && mv bin/swctl-*-$utype-amd64 $BIN_DIR/swctl
+fi
\ No newline at end of file
diff --git a/test/e2e/script/prepare/install-yq.sh b/test/e2e/script/prepare/install-yq.sh
new file mode 100644
index 0000000..28fd299
--- /dev/null
+++ b/test/e2e/script/prepare/install-yq.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+BASE_DIR=$1
+BIN_DIR=$2
+
+if ! command -v yq &> /dev/null; then
+ mkdir -p $BASE_DIR/yq && cd $BASE_DIR/yq
+ curl -kLo yq.tar.gz https://github.com/mikefarah/yq/archive/v4.11.1.tar.gz
+ tar -zxf yq.tar.gz --strip=1
+ go install && go build -ldflags -s && cp yq $BIN_DIR/
+fi
\ No newline at end of file
diff --git a/test/e2e/script/prepare/install.sh b/test/e2e/script/prepare/install.sh
new file mode 100644
index 0000000..3d440fa
--- /dev/null
+++ b/test/e2e/script/prepare/install.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+set -ex
+
+NAME=$1
+CURRENT_DIR="$(cd "$(dirname $0)"; pwd)"
+
+# prepare base dir
+TMP_DIR=/tmp/skywalking-infra-e2e
+BIN_DIR=/usr/local/bin
+mkdir -p $TMP_DIR && cd $TMP_DIR
+
+# execute install
+bash $CURRENT_DIR/install-$NAME.sh $TMP_DIR $BIN_DIR
+
+echo "success to install $NAME"
\ No newline at end of file