You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by zh...@apache.org on 2021/10/23 05:20:51 UTC
[skywalking-client-js] branch master updated: Add e2e tese based on
skywaling-infra-e2e (#67)
This is an automated email from the ASF dual-hosted git repository.
zhangwei24 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-client-js.git
The following commit(s) were added to refs/heads/master by this push:
new af0565a Add e2e tese based on skywaling-infra-e2e (#67)
af0565a is described below
commit af0565a67d382b683c1dbd94c379b7080db61449
Author: zhang-wei <zh...@apache.org>
AuthorDate: Sat Oct 23 13:20:45 2021 +0800
Add e2e tese based on skywaling-infra-e2e (#67)
* add e2e
* add e2e
* add e2e
* add version
* add version
* Update test/docker-compose.yml
Co-authored-by: kezhenxu94 <ke...@apache.org>
* use b64enc func
* add trace detail
* verify more data
* verify more data
* verify more data
* verify more data
* verify more data
Co-authored-by: kezhenxu94 <ke...@apache.org>
---
.github/workflows/e2e.yml | 39 +++++++
test/base-compose.yml | 54 ++++++++++
test/docker-compose.yml | 126 ++++++++++++++++++++++
test/docker/Dockerfile.generate-traffic | 22 ++++
test/docker/Dockerfile.provider | 25 +++++
test/docker/Dockerfile.test-ui | 43 ++++++++
test/docker/index.js | 51 +++++++++
test/docker/nginx.conf | 39 +++++++
test/docker/provider.py | 57 ++++++++++
test/docker/test.py | 42 ++++++++
test/e2e.yaml | 143 +++++++++++++++++++++++++
test/env | 19 ++++
test/expected/dependency.yml | 37 +++++++
test/expected/error-log.yml | 30 ++++++
test/expected/metrics-has-value-percentile.yml | 47 ++++++++
test/expected/metrics-has-value.yml | 19 ++++
test/expected/page.yml | 17 +++
test/expected/service.yml | 18 ++++
test/expected/trace-detail.yml | 68 ++++++++++++
test/expected/traces.yml | 27 +++++
test/expected/version.yml | 20 ++++
21 files changed, 943 insertions(+)
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
new file mode 100644
index 0000000..bf1fdbe
--- /dev/null
+++ b/.github/workflows/e2e.yml
@@ -0,0 +1,39 @@
+# 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.
+
+name: E2E
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+
+jobs:
+ JavaScriptClient:
+ name: Java Script Client
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Setup go
+ uses: actions/setup-go@v2
+ with:
+ go-version: '1.16'
+ - uses: apache/skywalking-infra-e2e@0bab0f6e3ea7fe7e220bec32fa17df328d06ea26
+ with:
+ e2e-file: test/e2e.yaml
diff --git a/test/base-compose.yml b/test/base-compose.yml
new file mode 100644
index 0000000..5052358
--- /dev/null
+++ b/test/base-compose.yml
@@ -0,0 +1,54 @@
+# 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:
+ oap:
+ image: ghcr.io/apache/skywalking/oap:7a5fec56fed0eef60e36f619a8db09f823200201
+ expose:
+ - 11800
+ - 12800
+ - 10051
+ - 5005
+ networks:
+ - e2e
+ restart: on-failure
+ environment:
+ SW_CLUSTER_ZK_HOST_PORT: zk:2181
+ SW_STORAGE_ES_CLUSTER_NODES: es:9200
+ SW_JDBC_URL: jdbc:mysql://mysql:3306/swtest
+ SW_STORAGE_INFLUXDB_URL: http://influxdb:8086
+ JAVA_OPTS: >-
+ -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
+ healthcheck:
+ test: ["CMD", "sh", "-c", "nc -zn 127.0.0.1 11800"]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ ui:
+ image: ghcr.io/apache/skywalking/ui:7a5fec56fed0eef60e36f619a8db09f823200201
+ expose:
+ - 8080
+ networks:
+ - e2e
+ environment:
+ - SW_OAP_ADDRESS=oap:12800
+ healthcheck:
+ test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 8080" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
diff --git a/test/docker-compose.yml b/test/docker-compose.yml
new file mode 100644
index 0000000..fb50b0c
--- /dev/null
+++ b/test/docker-compose.yml
@@ -0,0 +1,126 @@
+# 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:
+ oap:
+ extends:
+ file: base-compose.yml
+ service: oap
+ ports:
+ - 12800
+ environment:
+ SW_STORAGE: h2
+
+ ui:
+ extends:
+ file: base-compose.yml
+ service: ui
+ ports:
+ - 8080
+ depends_on:
+ oap:
+ condition: service_healthy
+
+ provider:
+ build:
+ context: ./
+ dockerfile: docker/Dockerfile.provider
+ args:
+ - SW_AGENT_PYTHON_COMMIT=${SW_AGENT_PYTHON_COMMIT}
+ command: [ 'python3', '/entrypoint.py' ]
+ networks:
+ - e2e
+ expose:
+ - 9091
+ environment:
+ SW_AGENT_COLLECTOR_BACKEND_SERVICES: oap:11800
+ SW_AGENT_LOGGING_LEVEL: DEBUG
+ volumes:
+ - ./docker/provider.py:/entrypoint.py
+ depends_on:
+ oap:
+ condition: service_healthy
+ healthcheck:
+ test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9091" ]
+ interval: 5s
+ timeout: 60s
+ retries: 120
+
+ testui:
+ build:
+ context: ../
+ dockerfile: test/docker/Dockerfile.test-ui
+ args:
+ - SW_AGENT_CLIENT_JS_TEST_COMMIT=${SW_AGENT_CLIENT_JS_TEST_COMMIT}
+ networks:
+ - e2e
+ ports:
+ - 80
+ depends_on:
+ provider:
+ condition: service_healthy
+ oap:
+ condition: service_healthy
+
+ selenium-hub:
+ image: selenium/hub:4.0.0-alpha-7-prerelease-20201009
+ networks:
+ - e2e
+ expose:
+ - 4444
+ depends_on:
+ testui:
+ condition: service_started
+ provider:
+ condition: service_healthy
+
+ chrome:
+ image: selenium/node-chrome:4.0.0-alpha-7-prerelease-20201009
+ networks:
+ - e2e
+ volumes:
+ - /dev/shm:/dev/shm
+ depends_on:
+ selenium-hub:
+ condition: service_started
+ testui:
+ condition: service_started
+ provider:
+ condition: service_healthy
+ environment:
+ - SE_EVENT_BUS_HOST=selenium-hub
+ - SE_EVENT_BUS_PUBLISH_PORT=4442
+ - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
+ generate-traffic:
+ build:
+ context: .
+ dockerfile: docker/Dockerfile.generate-traffic
+ networks:
+ - e2e
+ restart: always
+ depends_on:
+ selenium-hub:
+ condition: service_started
+ chrome:
+ condition: service_started
+ provider:
+ condition: service_healthy
+ testui:
+ condition: service_started
+
+networks:
+ e2e:
diff --git a/test/docker/Dockerfile.generate-traffic b/test/docker/Dockerfile.generate-traffic
new file mode 100644
index 0000000..0939810
--- /dev/null
+++ b/test/docker/Dockerfile.generate-traffic
@@ -0,0 +1,22 @@
+# 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.
+
+FROM python:3.7
+
+COPY docker/test.py .
+
+RUN pip3 install selenium
+
+CMD ["python3", "/test.py"]
diff --git a/test/docker/Dockerfile.provider b/test/docker/Dockerfile.provider
new file mode 100644
index 0000000..085f8c5
--- /dev/null
+++ b/test/docker/Dockerfile.provider
@@ -0,0 +1,25 @@
+# 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.
+
+FROM python:3.7
+ARG SW_AGENT_PYTHON_COMMIT
+
+WORKDIR /app
+
+RUN git clone https://github.com/apache/skywalking-python.git $(pwd)
+
+RUN git reset --hard ${SW_AGENT_PYTHON_COMMIT} && git submodule update --init
+
+RUN make setup install
diff --git a/test/docker/Dockerfile.test-ui b/test/docker/Dockerfile.test-ui
new file mode 100644
index 0000000..ecbb0fe
--- /dev/null
+++ b/test/docker/Dockerfile.test-ui
@@ -0,0 +1,43 @@
+# 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.
+
+FROM node:10.23 AS builder
+
+ADD . /skywalking-client-js
+WORKDIR /skywalking-client-js
+RUN npm run rebuild \
+ && npm link
+
+# download and build skywalking client test
+ARG SW_AGENT_CLIENT_JS_TEST_COMMIT
+ARG CLIENT_JS_TEST_CODE=${SW_AGENT_CLIENT_JS_TEST_COMMIT}.tar.gz
+ARG CLIENT_JS_TEST_CODE_URL=https://github.com/SkyAPMTest/skywalking-client-test/archive/${CLIENT_JS_TEST_CODE}
+
+WORKDIR /skywalking-client-test
+ADD ${CLIENT_JS_TEST_CODE_URL} .
+RUN tar -xf ${CLIENT_JS_TEST_CODE} --strip 1 \
+ && rm ${CLIENT_JS_TEST_CODE} \
+ && rm src/index.js
+COPY test/docker/index.js src/index.js
+
+RUN npm install \
+ && rm -rf node_modules/skywalking-client-js \
+ && npm link skywalking-client-js \
+ && npm run build
+
+FROM nginx:1.19
+
+COPY --from=builder /skywalking-client-test/dist/* /etc/nginx/html/
+COPY test/docker/nginx.conf /etc/nginx/nginx.conf
diff --git a/test/docker/index.js b/test/docker/index.js
new file mode 100644
index 0000000..eae9167
--- /dev/null
+++ b/test/docker/index.js
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+import ClientMonitor from 'skywalking-client-js';
+import Vue from 'vue';
+
+ClientMonitor.register({
+ service: 'test-ui',
+ pagePath: 'index.html',
+ serviceVersion: 'v1.0.0',
+ vue: Vue,
+ useFmp: true,
+ traceTimeInterval: 2000,
+});
+
+// vue error
+new Vue({
+ methods: {
+ test() {
+ throw {
+ msg: 'vue error',
+ status: 3000
+ }
+ }
+ },
+ created() {
+ this.test();
+ }
+})
+
+fetch('http://provider:9091/info', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+}).then((data) => {
+ console.log(data.body);
+})
diff --git a/test/docker/nginx.conf b/test/docker/nginx.conf
new file mode 100644
index 0000000..ea88f47
--- /dev/null
+++ b/test/docker/nginx.conf
@@ -0,0 +1,39 @@
+# 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.
+
+worker_processes auto;
+events {
+ worker_connections 1024;
+}
+http {
+ server_tokens off;
+ client_header_timeout 10;
+ client_body_timeout 10;
+ # limit_conn_zone $binary_remote_addr zone=addr:5m;
+ # limit_conn addr 100;
+ index index.html;
+ server {
+ listen 80;
+ location /browser {
+ proxy_pass http://oap:12800;
+ }
+ location /v3 {
+ proxy_pass http://oap:12800;
+ }
+ location /info {
+ proxy_pass http://provider:9091;
+ }
+ }
+}
diff --git a/test/docker/provider.py b/test/docker/provider.py
new file mode 100644
index 0000000..83b0cca
--- /dev/null
+++ b/test/docker/provider.py
@@ -0,0 +1,57 @@
+#
+# 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.
+#
+import time
+
+from urllib import request
+
+from skywalking import agent, config
+
+if __name__ == '__main__':
+ config.service_name = 'provider-py'
+ config.logging_level = 'DEBUG'
+ agent.start()
+
+ import socketserver
+ from http.server import BaseHTTPRequestHandler
+
+ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
+
+ def _send_cors_headers(self):
+ """ sets headers required for cors """
+ self.send_header("Access-Control-Allow-Origin", "*")
+ self.send_header("Access-Control-Allow-Methods", "*")
+ self.send_header("Access-Control-Allow-Headers", "*")
+
+ def do_OPTIONS(self):
+ self.send_response(200)
+ self._send_cors_headers()
+ self.end_headers()
+
+ def do_POST(self):
+ time.sleep(0.5)
+ self.send_response(200)
+ self.send_header('Content-Type', 'application/json')
+ self._send_cors_headers()
+ self.end_headers()
+ self.wfile.write('{"name": "whatever"}'.encode('ascii'))
+
+ PORT = 9091
+ Handler = SimpleHTTPRequestHandler
+
+ with socketserver.TCPServer(("", PORT), Handler) as httpd:
+ print("serving at port", PORT)
+ httpd.serve_forever()
diff --git a/test/docker/test.py b/test/docker/test.py
new file mode 100644
index 0000000..7e9a21f
--- /dev/null
+++ b/test/docker/test.py
@@ -0,0 +1,42 @@
+# 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.
+
+import os
+import time
+
+from selenium import webdriver as wd
+from selenium.webdriver.common.desired_capabilities import DesiredCapabilities as DC
+
+hub_remote_url = os.environ.get("HUB_REMOTE_URL", "http://selenium-hub:4444/wd/hub")
+test_url = os.environ.get("TEST_URL", "http://testui:80/")
+
+
+def test_screenshot():
+ try:
+ driver.get(test_url)
+ except Exception as e:
+ print(e)
+
+try:
+ driver = wd.Remote(
+ command_executor=hub_remote_url,
+ desired_capabilities=DC.CHROME)
+
+ while True:
+ test_screenshot()
+ time.sleep(10)
+
+finally:
+ driver.quit()
diff --git a/test/e2e.yaml b/test/e2e.yaml
new file mode 100644
index 0000000..2b50e24
--- /dev/null
+++ b/test/e2e.yaml
@@ -0,0 +1,143 @@
+# 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: env
+ steps:
+ - name: install yq
+ command: |-
+ BASE_DIR=/tmp/skywalking-infra-e2e
+ BIN_DIR=/usr/local/bin
+
+ 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
+ - name: install swctl
+ command: |-
+ BASE_DIR=/tmp/skywalking-infra-e2e
+ BIN_DIR=/usr/local/bin
+
+ 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
+cleanup:
+ # always never success failure
+ on: always
+
+trigger:
+ action: http
+ interval: 3s
+ times: 5
+ url: http://127.0.0.1:${ui_8080}/
+ method: GET
+
+verify:
+ # verify with retry strategy
+ retry:
+ # max retry count
+ count: 20
+ # the interval between two retries, in millisecond.
+ interval: 3s
+ cases:
+ # service
+ - expected: expected/service.yml
+ query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql browser service ls test-ui
+ # version
+ - expected: expected/version.yml
+ query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql browser version ls --service-name test-ui
+ # page
+ - expected: expected/page.yml
+ query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql browser page ls --service-name test-ui
+ # browser error log
+ - expected: expected/error-log.yml
+ query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql browser logs ls --service-name test-ui --version-name v1.0.0
+ # browser service metrics
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_pv --service-id dGVzdC11aQ==.1 |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_error_sum --service-id dGVzdC11aQ==.1 |yq e 'to_entries' -
+ # browser version metrics
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_single_version_pv --service-id dGVzdC11aQ==.1 --instance-name v1.0.0 |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_single_version_error_sum --service-id dGVzdC11aQ==.1 --instance-name v1.0.0 |yq e 'to_entries' -
+ # browser page metrics
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_pv --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_error_sum --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_js_error_sum --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ # # browser performance metrics
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_dom_analysis_avg --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_dom_ready_avg --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_load_page_avg --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ - expected: expected/metrics-has-value.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear \
+ --name=browser_app_page_ttl_avg --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries' -
+ - expected: expected/metrics-has-value-percentile.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear \
+ --name=browser_app_page_dom_ready_percentile --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ - expected: expected/metrics-has-value-percentile.yml
+ query: |
+ swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics multiple-linear \
+ --name=browser_app_page_load_page_percentile --service-id dGVzdC11aQ==.1 --endpoint-name index.html |yq e 'to_entries | with(.[] ; .value=(.value | to_entries))' -
+ # dependency service
+ - expected: expected/dependency.yml
+ query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql dependency service --service-id dGVzdC11aTxicm93c2VyPg==.1
+ # trace
+ - expected: expected/traces.yml
+ query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls
+ - expected: expected/trace-detail.yml
+ 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 'index.html' | tail -n1 | awk -F ' ' '{print $2}')
diff --git a/test/env b/test/env
new file mode 100644
index 0000000..4cf6a6b
--- /dev/null
+++ b/test/env
@@ -0,0 +1,19 @@
+# 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.
+
+SW_AGENT_PYTHON_COMMIT=c8479000eb729cc86509222fd48b942edcaaca74
+SW_AGENT_CLIENT_JS_TEST_COMMIT=4f1eb1dcdbde3ec4a38534bf01dded4ab5d2f016
+
+SW_CTL_COMMIT=d2f1cff71f3ea9f325ff1c0d99dd0c40a35e527c
diff --git a/test/expected/dependency.yml b/test/expected/dependency.yml
new file mode 100644
index 0000000..7cd89cd
--- /dev/null
+++ b/test/expected/dependency.yml
@@ -0,0 +1,37 @@
+# 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.
+
+nodes:
+{{- contains .nodes }}
+- id: {{ b64enc "provider-py"}}.1
+ name: provider-py
+ type: Python
+ isreal: true
+- id: {{ b64enc "test-ui<browser>"}}.1
+ name: test-ui<browser>
+ type: null
+ isreal: true
+{{- end }}
+calls:
+{{- contains .calls }}
+- source: {{ b64enc "test-ui<browser>"}}.1
+ sourcecomponents: []
+ target: {{ b64enc "provider-py"}}.1
+ targetcomponents: []
+ id: {{ b64enc "test-ui<browser>"}}.1-{{ b64enc "provider-py"}}.1
+ detectpoints:
+ - CLIENT
+ - SERVER
+{{- end }}
diff --git a/test/expected/error-log.yml b/test/expected/error-log.yml
new file mode 100644
index 0000000..f1bd1e6
--- /dev/null
+++ b/test/expected/error-log.yml
@@ -0,0 +1,30 @@
+# 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.
+logs:
+{{- contains .logs }}
+- service: test-ui
+ serviceversion: v1.0.0
+ time: {{ gt .time 0 }}
+ pagepath: index.html
+ category: {{ notEmpty .category }}
+ grade: {{ notEmpty .grade }}
+ message: {{ notEmpty .message }}
+ line: 0
+ col: 0
+ stack: ""
+ errorurl: http://testui/
+ firstreportederror: {{ .firstreportederror }}
+{{- end }}
+total: {{ gt .total 0 }}
diff --git a/test/expected/metrics-has-value-percentile.yml b/test/expected/metrics-has-value-percentile.yml
new file mode 100644
index 0000000..ef17490
--- /dev/null
+++ b/test/expected/metrics-has-value-percentile.yml
@@ -0,0 +1,47 @@
+# 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.
+
+{{- contains . }}
+- key: 0
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+- key: 1
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+- key: 2
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+- key: 3
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+- key: 4
+ value:
+ {{- contains .value }}
+ - key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+ {{- end }}
+{{- end }}
diff --git a/test/expected/metrics-has-value.yml b/test/expected/metrics-has-value.yml
new file mode 100644
index 0000000..5359e6d
--- /dev/null
+++ b/test/expected/metrics-has-value.yml
@@ -0,0 +1,19 @@
+# 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.
+
+{{- contains . }}
+- key: {{ notEmpty .key }}
+ value: {{ ge .value 1 }}
+{{- end }}
diff --git a/test/expected/page.yml b/test/expected/page.yml
new file mode 100644
index 0000000..554fdf8
--- /dev/null
+++ b/test/expected/page.yml
@@ -0,0 +1,17 @@
+# 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.
+
+- id: {{ b64enc "test-ui" }}.1_{{ b64enc "index.html" }}
+ name: index.html
diff --git a/test/expected/service.yml b/test/expected/service.yml
new file mode 100644
index 0000000..b81f77f
--- /dev/null
+++ b/test/expected/service.yml
@@ -0,0 +1,18 @@
+# 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.
+
+- id: {{ b64enc "test-ui" }}.1
+ name: test-ui
+ group: ""
diff --git a/test/expected/trace-detail.yml b/test/expected/trace-detail.yml
new file mode 100644
index 0000000..3d2bb3d
--- /dev/null
+++ b/test/expected/trace-detail.yml
@@ -0,0 +1,68 @@
+# 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.
+
+spans:
+{{- contains .spans }}
+ - traceid: {{ notEmpty .traceid }}
+ segmentid: {{ notEmpty .segmentid }}
+ spanid: 0
+ parentspanid: -1
+ refs: []
+ servicecode: test-ui<browser>
+ serviceinstancename: "v1.0.0"
+ starttime: {{ gt .starttime 0 }}
+ endtime: {{ gt .endtime 0 }}
+ endpointname: index.html
+ type: Exit
+ peer: provider:9091
+ component: ajax
+ iserror: false
+ layer: Http
+ tags:
+ - key: http.method
+ value: POST
+ - key: url
+ value: http://provider:9091/info
+ logs: []
+ - traceid: {{ notEmpty .traceid }}
+ segmentid: {{ notEmpty .segmentid }}
+ spanid: 0
+ parentspanid: -1
+ refs:
+ {{- contains .refs }}
+ - traceid: {{ notEmpty .traceid }}
+ parentsegmentid: {{ notEmpty .parentsegmentid }}
+ parentspanid: 0
+ type: CROSS_PROCESS
+ {{- end }}
+ servicecode: provider-py
+ serviceinstancename: {{ notEmpty .serviceinstancename }}
+ starttime: {{ gt .starttime 0 }}
+ endtime: {{ gt .endtime 0 }}
+ endpointname: /info
+ type: Entry
+ peer: {{ notEmpty .peer }}
+ component: Python
+ iserror: false
+ layer: Http
+ tags:
+ - key: http.method
+ value: POST
+ - key: http.url
+ value: http://provider:9091/info
+ - key: http.status.code
+ value: "200"
+ logs: []
+{{- end }}
diff --git a/test/expected/traces.yml b/test/expected/traces.yml
new file mode 100644
index 0000000..763b930
--- /dev/null
+++ b/test/expected/traces.yml
@@ -0,0 +1,27 @@
+# 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:
+{{- contains .traces }}
+- segmentid: {{ notEmpty .segmentid }}
+ endpointnames:
+ - index.html
+ duration: {{ gt .duration 0 }}
+ start: "{{ notEmpty .start}}"
+ iserror: false
+ traceids:
+ - {{ notEmpty (index .traceids 0) }}
+{{- end }}
+total: {{ gt .total 0 }}
diff --git a/test/expected/version.yml b/test/expected/version.yml
new file mode 100644
index 0000000..ad097ed
--- /dev/null
+++ b/test/expected/version.yml
@@ -0,0 +1,20 @@
+# 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.
+
+- id: {{ b64enc "test-ui" }}.1_{{ b64enc "v1.0.0" }}
+ name: v1.0.0
+ attributes: []
+ language: UNKNOWN
+ instanceuuid: {{ b64enc "test-ui" }}.1_{{ b64enc "v1.0.0" }}