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.git
The following commit(s) were added to refs/heads/master by this push: new 5a6a1db Replace e2e cases to e2e-v2: Profile (#7967) 5a6a1db is described below commit 5a6a1dbb2696710bfd7d721a7a6e9635dcf6975f Author: wankai123 <wankai...@foxmail.com> AuthorDate: Wed Oct 20 10:19:10 2021 +0800 Replace e2e cases to e2e-v2: Profile (#7967) --- .github/workflows/e2e.event.yaml | 2 - .github/workflows/e2e.profiling.yaml | 20 ++---- CHANGES.md | 1 + test/e2e-v2/cases/event/h2/docker-compose.yml | 4 +- test/e2e-v2/cases/log/h2/docker-compose.yml | 2 +- .../{log/h2 => profile/es}/docker-compose.yml | 46 ++++++------- .../h2/Dockerfile.h2 => profile/es/e2e.yaml} | 27 ++++++-- .../cases/profile/expected/profile-cases.yaml | 59 +++++++++++++++++ .../expected/profile-create.yml} | 11 +--- .../expected/profile-list-finished.yml} | 28 +++++--- .../expected/profile-list-notified.yml} | 28 +++++--- .../expected/profile-segment-analyze.yml} | 22 ++++--- .../expected/profile-segment-detail.yml} | 34 +++++++--- .../expected/profile-segment-list.yml} | 21 +++--- .../expected/service-endpoint.yml} | 13 ++-- .../cases/profile/expected/service-instance.yml | 40 ++++++++++++ .../Dockerfile.h2 => profile/expected/service.yml} | 14 ++-- .../expected/traces-list.yml} | 21 +++--- .../cases/{log => profile}/h2/docker-compose.yml | 32 ++++----- .../h2/Dockerfile.h2 => profile/h2/e2e.yaml} | 27 ++++++-- .../h2 => profile/influxdb}/docker-compose.yml | 41 +++++------- .../h2/Dockerfile.h2 => profile/influxdb/e2e.yaml} | 27 ++++++-- .../{log/h2 => profile/mysql}/docker-compose.yml | 44 ++++++------- .../h2/Dockerfile.h2 => profile/mysql/e2e.yaml} | 27 ++++++-- test/e2e-v2/cases/profile/profile-cases.yaml | 76 ++++++++++++++++++++++ test/e2e-v2/cases/storage/h2/docker-compose.yml | 2 +- .../storage/h2 => script/dockerfile}/Dockerfile.h2 | 0 27 files changed, 450 insertions(+), 219 deletions(-) diff --git a/.github/workflows/e2e.event.yaml b/.github/workflows/e2e.event.yaml index 899e0bd..9131f8f 100644 --- a/.github/workflows/e2e.event.yaml +++ b/.github/workflows/e2e.event.yaml @@ -43,8 +43,6 @@ jobs: - event/es/e2e.yaml - event/mysql/e2e.yaml - event/influxdb/e2e.yaml - env: - SW_STORAGE: ${{ matrix.storage }} steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/e2e.profiling.yaml b/.github/workflows/e2e.profiling.yaml index f96ed62..169041c 100644 --- a/.github/workflows/e2e.profiling.yaml +++ b/.github/workflows/e2e.profiling.yaml @@ -39,17 +39,11 @@ jobs: timeout-minutes: 90 strategy: matrix: - storage: ['h2', 'mysql', 'es', 'influxdb'] - include: - - { storage: es, es-version: 6.3.2 } - - { storage: es, es-version: 7.0.0 } - - { storage: es, es-version: 7.8.0 } - - { storage: es, es-version: 7.10.1 } - - { storage: es, es-version: 7.14.0 } - - { storage: es, es-version: 7.15.0 } - env: - SW_STORAGE: ${{ matrix.storage }} - ES_VERSION: ${{ matrix.es-version }} + config-file: + - profile/h2/e2e.yaml + - profile/es/e2e.yaml + - profile/mysql/e2e.yaml + - profile/influxdb/e2e.yaml steps: - uses: actions/checkout@v2 with: @@ -58,6 +52,6 @@ jobs: uses: ./.github/actions/skip - name: Run E2E Test if: env.SKIP_CI != 'true' - uses: ./.github/actions/e2e-test + uses: ./.github/actions/infra-e2e-test with: - test_class: org.apache.skywalking.e2e.profile.ProfileE2E + config-file: ${{ matrix.config-file }} diff --git a/CHANGES.md b/CHANGES.md index d80e213..0401219 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Release Notes. - Storage - Cluster - Event + - Profile #### OAP Server diff --git a/test/e2e-v2/cases/event/h2/docker-compose.yml b/test/e2e-v2/cases/event/h2/docker-compose.yml index 3b3a118..9db5c9d 100644 --- a/test/e2e-v2/cases/event/h2/docker-compose.yml +++ b/test/e2e-v2/cases/event/h2/docker-compose.yml @@ -16,12 +16,10 @@ version: '3.8' services: - - h2db: build: context: . - dockerfile: Dockerfile.h2 + dockerfile: ../../../script/dockerfile/Dockerfile.h2 networks: - e2e expose: diff --git a/test/e2e-v2/cases/log/h2/docker-compose.yml b/test/e2e-v2/cases/log/h2/docker-compose.yml index 6f65700..1c566ff 100644 --- a/test/e2e-v2/cases/log/h2/docker-compose.yml +++ b/test/e2e-v2/cases/log/h2/docker-compose.yml @@ -19,7 +19,7 @@ services: h2db: build: context: . - dockerfile: Dockerfile.h2 + dockerfile: ../../../script/dockerfile/Dockerfile.h2 networks: - e2e expose: diff --git a/test/e2e-v2/cases/log/h2/docker-compose.yml b/test/e2e-v2/cases/profile/es/docker-compose.yml similarity index 77% copy from test/e2e-v2/cases/log/h2/docker-compose.yml copy to test/e2e-v2/cases/profile/es/docker-compose.yml index 6f65700..405943d 100644 --- a/test/e2e-v2/cases/log/h2/docker-compose.yml +++ b/test/e2e-v2/cases/profile/es/docker-compose.yml @@ -13,49 +13,45 @@ # See the License for the specific language governing permissions and # limitations under the License. -version: '2.1' +version: '3.8' services: - h2db: - build: - context: . - dockerfile: Dockerfile.h2 + es: + image: elastic/elasticsearch:7.15.0 + expose: + - 9200 networks: - e2e - expose: - - 1521 + environment: + - discovery.type=single-node + - cluster.routing.allocation.disk.threshold_enabled=false healthcheck: - test: [ "CMD", "sh", "-c", "nc -z 127.0.0.1 1521" ] + test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"] interval: 5s timeout: 60s retries: 120 - oap: + provider: extends: - file: ../log-base-compose.yml - service: oap - environment: - SW_STORAGE: h2 - SW_STORAGE_H2_URL: jdbc:h2:tcp://h2db:1521/skywalking-oap-db + file: ../../../script/docker-compose/base-compose.yml + service: provider depends_on: - h2db: + oap: condition: service_healthy ports: - - 12800 - networks: - - e2e + - 9090 - provider: + oap: extends: file: ../../../script/docker-compose/base-compose.yml - service: provider - ports: - - 9090 - networks: - - e2e + service: oap + environment: + SW_STORAGE: elasticsearch depends_on: - oap: + es: condition: service_healthy + ports: + - 12800 networks: e2e: diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/es/e2e.yaml similarity index 55% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/es/e2e.yaml index b77f407..94450bd 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/es/e2e.yaml @@ -13,12 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine +# This file is used to show how to write configuration files and can be used to test. -WORKDIR /h2 +setup: + env: compose + file: docker-compose.yml + timeout: 1200 + init-system-environment: ../../../script/env + steps: + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + - name: install etcdctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh etcdctl -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +verify: + retry: + count: 20 + interval: 3s + cases: + - includes: + - ../profile-cases.yaml diff --git a/test/e2e-v2/cases/profile/expected/profile-cases.yaml b/test/e2e-v2/cases/profile/expected/profile-cases.yaml new file mode 100644 index 0000000..30e1958 --- /dev/null +++ b/test/e2e-v2/cases/profile/expected/profile-cases.yaml @@ -0,0 +1,59 @@ +# 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. + + cases: + # trace segment list + - query: | + curl -s -XPOST http://${provider_host}:${provider_9090}/profile/users?e2e=true -d '{"enableProfiling":"false","name":"SkyWalking"}' -H "Content-Type: application/json" > /dev/null; + sleep 3; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls --service-name=e2e-service-provider + expected: expected/traces-list.yml + # service list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls + expected: expected/service.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 endpoint + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint list --keyword=profile --service-name=e2e-service-provider + expected: expected/service-endpoint.yml + # create task + - query: | + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql \ + profile create --service-name=e2e-service-provider \ + --endpoint-name=POST:/profile/{name} \ + --start-time=-1 \ + --duration=1 \ + --dump-period=500 --max-sampling-count=5 + expected: expected/profile-create.yml + # profile list notified: sleep to wait agent notices and query profile list + - query: sleep 3 && swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list -service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} + expected: expected/profile-list-notified.yml + # profile list finished: + - query: | + curl -s -XPOST http://${provider_host}:${provider_9090}/profile/users?e2e=true -d '{"enableProfiling":"true","name":"SkyWalking"}' -H "Content-Type: application/json" > /dev/null; + sleep 3; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list -service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} + expected: expected/traces-list-finished.yml + # profiled segment list + - query: | + curl -X POST http://${consumer_host}:${consumer_9092}/info > /dev/null; + sleep 5; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$( \ + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} | yq e '.[0].id' - \ + ) + expected: expected/profile-segment-list.yml diff --git a/test/e2e-v2/cases/log/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/profile-create.yml similarity index 73% rename from test/e2e-v2/cases/log/h2/Dockerfile.h2 rename to test/e2e-v2/cases/profile/expected/profile-create.yml index b77f407..c6dee76 100644 --- a/test/e2e-v2/cases/log/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/profile-create.yml @@ -13,12 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +id: {{ notEmpty .id }} +errorreason: null diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/profile-list-finished.yml similarity index 58% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/profile-list-finished.yml index b77f407..25e7f87 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/profile-list-finished.yml @@ -13,12 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +{{- contains . }} +- id: {{ notEmpty .id }} + serviceid: {{ b64enc "e2e-service-provider" }}.1 + servicename: "" + endpointname: POST:/profile/{name} + starttime: {{ gt .starttime 0 }} + duration: 1 + mindurationthreshold: 1500 + dumpperiod: 500 + maxsamplingcount: 5 + logs: + {{- contains .logs }} + - id: {{ notEmpty .id }} + instanceid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} + operationtype: EXECUTION_FINISHED + instancename: "" + operationtime: {{ gt .operationtime 0 }} + {{- end }} +{{- end }} diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/profile-list-notified.yml similarity index 59% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/profile-list-notified.yml index b77f407..faaaa0f 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/profile-list-notified.yml @@ -13,12 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +{{- contains . }} +- id: {{ notEmpty .id }} + serviceid: {{ b64enc "e2e-service-provider" }}.1 + servicename: "" + endpointname: POST:/profile/{name} + starttime: {{ gt .starttime 0 }} + duration: 1 + mindurationthreshold: 1500 + dumpperiod: 500 + maxsamplingcount: 5 + logs: + {{- contains .logs }} + - id: {{ notEmpty .id }} + instanceid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} + operationtype: NOTIFIED + instancename: "" + operationtime: {{ gt .operationtime 0 }} + {{- end }} +{{- end }} diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/profile-segment-analyze.yml similarity index 67% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/profile-segment-analyze.yml index b77f407..683e539 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/profile-segment-analyze.yml @@ -13,12 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +tip: null +trees: + {{- contains .trees }} + - elements: + {{- contains .elements }} + - id: "{{ notEmpty .id }}" + parentid: "{{ notEmpty .parentid }}" + codesignature: "test.apache.skywalking.e2e.profile.ProfileController.createAuthor:-1" + duration: {{ gt .duration 0 }} + durationchildexcluded: 0 + count: {{ gt .count 0 }} + {{- end }} + {{- end }} diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/profile-segment-detail.yml similarity index 60% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/profile-segment-detail.yml index b77f407..7b22363 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/profile-segment-detail.yml @@ -13,12 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +spans: +{{- contains .spans }} +- spanid: 0 + parentspanid: -1 + servicecode: e2e-service-provider + serviceinstancename: "" + starttime: {{ gt .starttime 0 }} + endtime: {{ gt .endtime 0 }} + endpointname: POST:/profile/{name} + type: Entry + peer: "" + component: SpringMVC + iserror: false + layer: Http + tags: + {{- contains .tags }} + - key: url + value: {{ notEmpty .value }} + - key: http.method + value: POST + - key: http.params + value: "e2e=[true]" + {{- end }} + logs: [] +{{- end }} diff --git a/test/e2e-v2/cases/event/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/profile-segment-list.yml similarity index 73% rename from test/e2e-v2/cases/event/h2/Dockerfile.h2 rename to test/e2e-v2/cases/profile/expected/profile-segment-list.yml index b77f407..a923046 100644 --- a/test/e2e-v2/cases/event/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/profile-segment-list.yml @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +{{- contains . }} +- segmentid: {{ notEmpty .segmentid }} + endpointnames: + - POST:/profile/{name} + duration: {{ gt .duration 0 }} + start: "{{ notEmpty .start }}" + iserror: false + traceids: + {{- contains .traceids }} + - {{ notEmpty . }} + {{- end }} +{{- end }} diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/service-endpoint.yml similarity index 73% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/service-endpoint.yml index b77f407..eb6c743 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/service-endpoint.yml @@ -13,12 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +{{- contains . }} +- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "POST:/profile/{name}" }} + name: POST:/profile/{name} +{{- end}} diff --git a/test/e2e-v2/cases/profile/expected/service-instance.yml b/test/e2e-v2/cases/profile/expected/service-instance.yml new file mode 100644 index 0000000..e525205 --- /dev/null +++ b/test/e2e-v2/cases/profile/expected/service-instance.yml @@ -0,0 +1,40 @@ +# Licensed to 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. Apache Software Foundation (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. + +{{- contains . }} +- id: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} + name: provider1 + attributes: + {{- contains .attributes }} + - name: OS Name + value: Linux + - name: hostname + value: {{ notEmpty .value }} + - name: Process No. + value: "1" + - name: Start Time + value: {{ notEmpty .value }} + - name: JVM Arguments + value: '{{ notEmpty .value }}' + - name: Jar Dependencies + value: '{{ notEmpty .value }}' + - name: ipv4s + value: {{ notEmpty .value }} + {{- end}} + language: JAVA + instanceuuid: {{ b64enc "e2e-service-provider" }}.1_{{ b64enc "provider1" }} +{{- end}} diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/service.yml similarity index 73% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/service.yml index b77f407..3a33348 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/service.yml @@ -13,12 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +{{- contains . }} +- id: {{ b64enc "e2e-service-provider" }}.1 + name: e2e-service-provider + group: "" +{{- end }} diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/expected/traces-list.yml similarity index 73% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/expected/traces-list.yml index b77f407..45322c3 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/expected/traces-list.yml @@ -13,12 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine - -WORKDIR /h2 - -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +traces: +{{- contains .traces }} +- segmentid: {{ notEmpty .segmentid }} + endpointnames: + - POST:/profile/{name} + duration: {{ ge .duration 0 }} + start: "{{ notEmpty .start}}" + iserror: false + traceids: + - {{ (index .traceids 0) }} +{{- end }} +total: {{ gt .total 0 }} diff --git a/test/e2e-v2/cases/log/h2/docker-compose.yml b/test/e2e-v2/cases/profile/h2/docker-compose.yml similarity index 87% copy from test/e2e-v2/cases/log/h2/docker-compose.yml copy to test/e2e-v2/cases/profile/h2/docker-compose.yml index 6f65700..ed2cd25 100644 --- a/test/e2e-v2/cases/log/h2/docker-compose.yml +++ b/test/e2e-v2/cases/profile/h2/docker-compose.yml @@ -19,20 +19,30 @@ services: h2db: build: context: . - dockerfile: Dockerfile.h2 + dockerfile: ../../../script/dockerfile/Dockerfile.h2 networks: - e2e expose: - 1521 healthcheck: - test: [ "CMD", "sh", "-c", "nc -z 127.0.0.1 1521" ] + test: ["CMD", "sh", "-c", "nc -z 127.0.0.1 1521"] interval: 5s timeout: 60s retries: 120 + provider: + extends: + file: ../../../script/docker-compose/base-compose.yml + service: provider + depends_on: + oap: + condition: service_healthy + ports: + - 9090 + oap: extends: - file: ../log-base-compose.yml + file: ../../../script/docker-compose/base-compose.yml service: oap environment: SW_STORAGE: h2 @@ -41,21 +51,7 @@ services: h2db: condition: service_healthy ports: - - 12800 - networks: - - e2e - - provider: - extends: - file: ../../../script/docker-compose/base-compose.yml - service: provider - ports: - - 9090 - networks: - - e2e - depends_on: - oap: - condition: service_healthy + - 12800 networks: e2e: diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/h2/e2e.yaml similarity index 55% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/h2/e2e.yaml index b77f407..94450bd 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/h2/e2e.yaml @@ -13,12 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine +# This file is used to show how to write configuration files and can be used to test. -WORKDIR /h2 +setup: + env: compose + file: docker-compose.yml + timeout: 1200 + init-system-environment: ../../../script/env + steps: + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + - name: install etcdctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh etcdctl -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +verify: + retry: + count: 20 + interval: 3s + cases: + - includes: + - ../profile-cases.yaml diff --git a/test/e2e-v2/cases/log/h2/docker-compose.yml b/test/e2e-v2/cases/profile/influxdb/docker-compose.yml similarity index 77% copy from test/e2e-v2/cases/log/h2/docker-compose.yml copy to test/e2e-v2/cases/profile/influxdb/docker-compose.yml index 6f65700..14ed91e 100644 --- a/test/e2e-v2/cases/log/h2/docker-compose.yml +++ b/test/e2e-v2/cases/profile/influxdb/docker-compose.yml @@ -16,46 +16,39 @@ version: '2.1' services: - h2db: - build: - context: . - dockerfile: Dockerfile.h2 + influxdb: + image: influxdb:1.7.9 + expose: + - 8086 networks: - e2e - expose: - - 1521 healthcheck: - test: [ "CMD", "sh", "-c", "nc -z 127.0.0.1 1521" ] + test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8086"] interval: 5s timeout: 60s retries: 120 - oap: + provider: extends: - file: ../log-base-compose.yml - service: oap - environment: - SW_STORAGE: h2 - SW_STORAGE_H2_URL: jdbc:h2:tcp://h2db:1521/skywalking-oap-db + file: ../../../script/docker-compose/base-compose.yml + service: provider depends_on: - h2db: + oap: condition: service_healthy ports: - - 12800 - networks: - - e2e + - 9090 - provider: + oap: extends: file: ../../../script/docker-compose/base-compose.yml - service: provider - ports: - - 9090 - networks: - - e2e + service: oap + environment: + SW_STORAGE: influxdb depends_on: - oap: + influxdb: condition: service_healthy + ports: + - 12800 networks: e2e: diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/influxdb/e2e.yaml similarity index 55% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/influxdb/e2e.yaml index b77f407..94450bd 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/influxdb/e2e.yaml @@ -13,12 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine +# This file is used to show how to write configuration files and can be used to test. -WORKDIR /h2 +setup: + env: compose + file: docker-compose.yml + timeout: 1200 + init-system-environment: ../../../script/env + steps: + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + - name: install etcdctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh etcdctl -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +verify: + retry: + count: 20 + interval: 3s + cases: + - includes: + - ../profile-cases.yaml diff --git a/test/e2e-v2/cases/log/h2/docker-compose.yml b/test/e2e-v2/cases/profile/mysql/docker-compose.yml similarity index 71% copy from test/e2e-v2/cases/log/h2/docker-compose.yml copy to test/e2e-v2/cases/profile/mysql/docker-compose.yml index 6f65700..8d0b176 100644 --- a/test/e2e-v2/cases/log/h2/docker-compose.yml +++ b/test/e2e-v2/cases/profile/mysql/docker-compose.yml @@ -16,46 +16,44 @@ version: '2.1' services: - h2db: - build: - context: . - dockerfile: Dockerfile.h2 + mysql: + image: mysql/mysql-server:8.0.13 networks: - e2e expose: - - 1521 + - 3306 + environment: + - MYSQL_ROOT_PASSWORD=root@1234 + - MYSQL_DATABASE=swtest + - MYSQL_ROOT_HOST=% healthcheck: - test: [ "CMD", "sh", "-c", "nc -z 127.0.0.1 1521" ] + test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ] interval: 5s timeout: 60s retries: 120 - oap: + provider: extends: - file: ../log-base-compose.yml - service: oap - environment: - SW_STORAGE: h2 - SW_STORAGE_H2_URL: jdbc:h2:tcp://h2db:1521/skywalking-oap-db + file: ../../../script/docker-compose/base-compose.yml + service: provider depends_on: - h2db: + oap: condition: service_healthy ports: - - 12800 - networks: - - e2e + - 9090 - provider: + oap: extends: file: ../../../script/docker-compose/base-compose.yml - service: provider - ports: - - 9090 - networks: - - e2e + service: oap + environment: + SW_STORAGE: mysql depends_on: - oap: + mysql: condition: service_healthy + entrypoint: ['sh', '-c', 'apk add --no-cache bash && /download-mysql.sh && /skywalking/docker-entrypoint.sh'] + ports: + - 12800 networks: e2e: diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/cases/profile/mysql/e2e.yaml similarity index 55% copy from test/e2e-v2/cases/storage/h2/Dockerfile.h2 copy to test/e2e-v2/cases/profile/mysql/e2e.yaml index b77f407..94450bd 100644 --- a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 +++ b/test/e2e-v2/cases/profile/mysql/e2e.yaml @@ -13,12 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM adoptopenjdk/openjdk8:alpine +# This file is used to show how to write configuration files and can be used to test. -WORKDIR /h2 +setup: + env: compose + file: docker-compose.yml + timeout: 1200 + init-system-environment: ../../../script/env + steps: + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + - name: install etcdctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh etcdctl -VOLUME /h2/data - -ADD https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar /h2 - -CMD ["sh", "-c", "java -cp /h2/*.jar org.h2.tools.Server -tcp -tcpAllowOthers -tcpPort 1521 -ifNotExists -baseDir /h2/data"] \ No newline at end of file +verify: + retry: + count: 20 + interval: 3s + cases: + - includes: + - ../profile-cases.yaml diff --git a/test/e2e-v2/cases/profile/profile-cases.yaml b/test/e2e-v2/cases/profile/profile-cases.yaml new file mode 100644 index 0000000..7c27b58 --- /dev/null +++ b/test/e2e-v2/cases/profile/profile-cases.yaml @@ -0,0 +1,76 @@ +# 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. + + cases: + # trace segment list + - query: | + curl -s -XPOST http://${provider_host}:${provider_9090}/profile/users?e2e=true -d '{"enableProfiling":"false","name":"SkyWalking"}' -H "Content-Type: application/json" > /dev/null; + sleep 3; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls --service-name=e2e-service-provider + expected: expected/traces-list.yml + # service list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls + expected: expected/service.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 endpoint + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint list --keyword=profile --service-name=e2e-service-provider + expected: expected/service-endpoint.yml + # create task + - query: | + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql \ + profile create --service-name=e2e-service-provider \ + --endpoint-name=POST:/profile/{name} \ + --start-time=-1 \ + --duration=1 --min-duration-threshold=1500 \ + --dump-period=500 --max-sampling-count=5 + expected: expected/profile-create.yml + # profile list notified: sleep to wait agent notices and query profile list + - query: sleep 3 && swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list -service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} + expected: expected/profile-list-notified.yml + # profile list finished: + - query: | + curl -s -XPOST http://${provider_host}:${provider_9090}/profile/users?e2e=true -d '{"enableProfiling":"true","name":"SkyWalking"}' -H "Content-Type: application/json" > /dev/null; + sleep 10; + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list -service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} + expected: expected/profile-list-finished.yml + # profiled segment list + - query: | + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$( \ + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} | yq e '.[0].id' - \ + ) + expected: expected/profile-segment-list.yml + # profiled segment detail + - query: | + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-segment --segment-id=$( \ + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$( \ + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} | yq e '.[0].id' - \ + ) | yq e '.[0].segmentid' - \ + ) + expected: expected/profile-segment-detail.yml + # query profiled segment analyze + - query: | + segmentid=$( \ + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile segment-list --task-id=$( \ + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile list --service-name=e2e-service-provider --endpoint-name=POST:/profile/{name} | yq e '.[0].id' - \ + ) | yq e '.[0].segmentid' - \ + ); + start=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-segment --segment-id=$segmentid | yq e '.spans[] | select(.spanid == 0).starttime' -); + end=$(swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-segment --segment-id=$segmentid | yq e '.spans[] | select(.spanid == 0).endtime' -); + swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql profile profiled-analyze --segment-id=$segmentid --time-ranges=$(echo $start"-"$end) + expected: expected/profile-segment-analyze.yml diff --git a/test/e2e-v2/cases/storage/h2/docker-compose.yml b/test/e2e-v2/cases/storage/h2/docker-compose.yml index 3b207dd..b525f47 100644 --- a/test/e2e-v2/cases/storage/h2/docker-compose.yml +++ b/test/e2e-v2/cases/storage/h2/docker-compose.yml @@ -19,7 +19,7 @@ services: h2db: build: context: . - dockerfile: Dockerfile.h2 + dockerfile: ../../../script/dockerfile/Dockerfile.h2 networks: - e2e expose: diff --git a/test/e2e-v2/cases/storage/h2/Dockerfile.h2 b/test/e2e-v2/script/dockerfile/Dockerfile.h2 similarity index 100% rename from test/e2e-v2/cases/storage/h2/Dockerfile.h2 rename to test/e2e-v2/script/dockerfile/Dockerfile.h2