You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/12/13 10:36:44 UTC

[skywalking-cli] branch master updated: Set up a simple test with GitHub Actions to verify the minimal functionalities (#80)

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-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 68ca77c  Set up a simple test with GitHub Actions to verify the minimal functionalities (#80)
68ca77c is described below

commit 68ca77c73eafc63a13178165d9d2ef4720b902e5
Author: Hoshea Jiang <fg...@gmail.com>
AuthorDate: Sun Dec 13 18:36:33 2020 +0800

    Set up a simple test with GitHub Actions to verify the minimal functionalities (#80)
---
 .github/workflows/go.yml |  3 +++
 Makefile                 | 11 ++++++++
 cmd/main.go              |  2 +-
 test/test_commands.sh    | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index f9e96ac..4bab776 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -61,3 +61,6 @@ jobs:
 
       - name: Build
         run: make build -j3
+
+      - name: Test commands
+        run: make test-commands
\ No newline at end of file
diff --git a/Makefile b/Makefile
index daf42b4..e8017d5 100644
--- a/Makefile
+++ b/Makefile
@@ -155,3 +155,14 @@ check-codegen: codegen
 		git status -s; \
 		exit 1; \
 	fi
+
+.PHONY: test-commands
+test-commands:
+	@if ! docker run --name oap -p 12800:12800 -p 11800:11800 -d -e SW_HEALTH_CHECKER=default -e SW_TELEMETRY=prometheus apache/skywalking-oap-server:latest > /dev/null 2>&1;then \
+		docker container stop oap; \
+		docker container prune -f; \
+		docker run --name oap -p 12800:12800 -p 11800:11800 -d -e SW_HEALTH_CHECKER=default -e SW_TELEMETRY=prometheus apache/skywalking-oap-server:latest; \
+	fi
+	./test/test_commands.sh
+	@docker container stop oap
+	@docker container prune -f
\ No newline at end of file
diff --git a/cmd/main.go b/cmd/main.go
index 4a57536..189bd5a 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -97,7 +97,7 @@ func main() {
 		altsrc.NewStringFlag(cli.StringFlag{
 			Name:     "display",
 			Required: false,
-			Usage:    "display `style` of the result, supported styles are: json, yaml, table",
+			Usage:    "display `style` of the result, supported styles are: json, yaml, table, graph",
 			Value:    "json",
 		}),
 	}
diff --git a/test/test_commands.sh b/test/test_commands.sh
new file mode 100755
index 0000000..35b305b
--- /dev/null
+++ b/test/test_commands.sh
@@ -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.
+
+set -ex
+
+if [ "$(uname)" == "Darwin" ]; then
+  os="darwin"
+else
+  os="linux"
+fi
+
+swctl="bin/swctl-latest-${os}-amd64 --base-url=http://localhost:12800/graphql"
+
+retries=1
+max_retries=10
+# Check whether OAP server is healthy.
+while ! ${swctl} ch > /dev/null 2>&1; do
+  if [[ $retries -ge $max_retries ]]; then
+    echo "OAP server is not healthy after $retries retires, will exit now"
+    exit 1
+  fi
+  echo "OAP server is not healthy, retrying [$retries/$max_retries] ..."
+  sleep 3
+  retries=$(($retries+1))
+done;
+
+${swctl} metrics ls > /dev/null 2>&1
+
+${swctl} service ls > /dev/null 2>&1
+
+${swctl} endpoint ls --service-id="test" > /dev/null 2>&1
+
+SERVICE_SCOPE_METRICS=(
+  service_resp_time
+  service_sla
+  service_cpm
+  service_apdex
+)
+
+for metrics in "${SERVICE_SCOPE_METRICS[@]}"; do
+  ${swctl} metrics linear --name="$metrics" --service="test" > /dev/null 2>&1
+
+  ${swctl} metrics single --name="$metrics" --service="test" > /dev/null 2>&1
+
+  ${swctl} metrics top 3 --name="$metrics" > /dev/null 2>&1
+done
+
+${swctl} metrics multiple-linear --name="all_percentile" > /dev/null 2>&1
+
+# Test `metrics thermodynamic`
+${swctl} metrics hp --name="all_heatmap" >/dev/null 2>&1
+
+${swctl} trace ls >/dev/null 2>&1
+
+# Test `dashboard global`
+${swctl} db g >/dev/null 2>&1