From cc8a6b6cfb1e539b1e4e56a64f3aa075397e7fba Mon Sep 17 00:00:00 2001 From: Ye Cao Date: Sat, 27 Apr 2024 18:30:49 +0800 Subject: [PATCH] Add the swck e2e test. Signed-off-by: Ye Cao --- .github/workflows/e2e.ci.yaml | 12 +- CHANGES.md | 2 +- chart/adapter/Chart.yaml | 2 +- chart/adapter/README.md | 2 +- chart/adapter/templates/deployment.yaml | 1 - chart/adapter/values.yaml | 2 +- chart/operator/Chart.yaml | 2 +- chart/operator/README.md | 2 +- chart/operator/templates/rbac.yaml | 43 +++++- test/e2e/expected/endpoint.yaml | 19 +++ test/e2e/expected/metrics.yaml | 25 ++++ test/e2e/expected/service-apdex.yaml | 25 ++++ test/e2e/expected/swck-demo-service.yaml | 26 ++++ .../{e2e.yaml => oap-agent-adapter-hpa.yaml} | 25 +++- test/e2e/swck/oap-agent-banyandb.yaml | 113 +++++++++++++++ test/e2e/swck/oap-ui-agent-elasticsearch.yaml | 111 +++++++++++++++ .../swck/oap-ui-agent-oapserverconfig.yaml | 130 ++++++++++++++++++ test/e2e/swck/oap-ui-agent-satellite.yaml | 104 ++++++++++++++ 18 files changed, 626 insertions(+), 20 deletions(-) create mode 100644 test/e2e/expected/endpoint.yaml create mode 100644 test/e2e/expected/metrics.yaml create mode 100644 test/e2e/expected/service-apdex.yaml create mode 100644 test/e2e/expected/swck-demo-service.yaml rename test/e2e/swck/{e2e.yaml => oap-agent-adapter-hpa.yaml} (78%) create mode 100644 test/e2e/swck/oap-agent-banyandb.yaml create mode 100644 test/e2e/swck/oap-ui-agent-elasticsearch.yaml create mode 100644 test/e2e/swck/oap-ui-agent-oapserverconfig.yaml create mode 100644 test/e2e/swck/oap-ui-agent-satellite.yaml diff --git a/.github/workflows/e2e.ci.yaml b/.github/workflows/e2e.ci.yaml index c6f0b4b..8b80da7 100644 --- a/.github/workflows/e2e.ci.yaml +++ b/.github/workflows/e2e.ci.yaml @@ -41,8 +41,16 @@ jobs: config: test/e2e/e2e-banyandb-standalone.yaml - name: Run Skywalking E2E Test (BanyanDB cluster as database) config: test/e2e/e2e-banyandb-cluster.yaml - - name: Run SWCK E2E Test - config: test/e2e/swck/e2e.yaml + - name: Run SWCK oap-agent-adapter-hpa Test + config: test/e2e/swck/oap-agent-adapter-hpa.yaml + - name: Run SWCK oap-agent-banyandb Test + config: test/e2e/swck/oap-agent-banyandb.yaml + - name: Run SWCK oap-ui-agent-elasticsearch Test + config: test/e2e/swck/oap-ui-agent-elasticsearch.yaml + - name: Run SWCK oap-ui-agent-oapserverconfig Test + config: test/e2e/swck/oap-ui-agent-oapserverconfig.yaml + - name: Run SWCK oap-ui-agent-satellite Test + config: test/e2e/swck/oap-ui-agent-satellite.yaml name: ${{ matrix.test.name }} env: OAP_TAG: 965dea898986ed2ab1343559fb20d6faed11ada9 diff --git a/CHANGES.md b/CHANGES.md index c8053e4..3b34d64 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,7 @@ Release Notes. ------------------ - Integrate BanyanDB as storage solution -- Bump up swck to v0.8.0 +- Bump up swck to v0.9.0 4.5.0 ------------------ diff --git a/chart/adapter/Chart.yaml b/chart/adapter/Chart.yaml index 97065c3..87e9a2a 100644 --- a/chart/adapter/Chart.yaml +++ b/chart/adapter/Chart.yaml @@ -16,7 +16,7 @@ apiVersion: v2 name: skywalking-helm-swck-adapter home: https://github.com/apache/skywalking-swck/tree/master/adapter -version: 0.8.0 +version: 0.9.0 description: Provide custom metrics coming from SkyWalking OAP cluster for autoscaling by Kubernetes HPA icon: https://raw.githubusercontent.com/apache/skywalking-kubernetes/master/logo/sw-logo-for-chart.jpg sources: diff --git a/chart/adapter/README.md b/chart/adapter/README.md index b224a7c..47245a0 100644 --- a/chart/adapter/README.md +++ b/chart/adapter/README.md @@ -45,7 +45,7 @@ The following table lists the configurable parameters of the adapter chart and t | `.serviceAccountName` | The service account name of adapter | `skywalking-custom-metrics-apiserver` | | `.image.repository` | Adapter container image name | `docker.io/apache/skywalking-swck` | | `.image.pullPolicy` | Adapter container image pull policy | `IfNotPresent` | -| `.image.tag` | Adapter container image tag | `v0.8.0` | +| `.image.tag` | Adapter container image tag | `v0.9.0` | | `.service.port` | The port for the adapter service | `6.1.0` | | `.oap.service.name` | The service name of OAP | `skywalking-system-oap` | | `.oap.service.namespace` | The service namespace of OAP | `skywalking-system` | diff --git a/chart/adapter/templates/deployment.yaml b/chart/adapter/templates/deployment.yaml index f297ff3..95fd34a 100644 --- a/chart/adapter/templates/deployment.yaml +++ b/chart/adapter/templates/deployment.yaml @@ -37,7 +37,6 @@ spec: containers: - args: - --secure-port={{ .Values.service.port }} - - --logtostderr=true - --v=10 - --oap-addr=http://{{ .Values.oap.service.name }}.{{ .Values.oap.service.namespace }}:{{ .Values.oap.service.port }}/graphql - --cert-dir=/tmp diff --git a/chart/adapter/values.yaml b/chart/adapter/values.yaml index aa941c0..c76bf3b 100644 --- a/chart/adapter/values.yaml +++ b/chart/adapter/values.yaml @@ -23,7 +23,7 @@ serviceAccountName: skywalking-custom-metrics-apiserver image: repository: docker.io/apache/skywalking-swck pullPolicy: IfNotPresent - tag: "v0.8.0" + tag: "v0.9.0" service: port: 6443 oap: diff --git a/chart/operator/Chart.yaml b/chart/operator/Chart.yaml index 5400c19..6854690 100644 --- a/chart/operator/Chart.yaml +++ b/chart/operator/Chart.yaml @@ -16,7 +16,7 @@ apiVersion: v2 name: skywalking-helm-swck-operator home: https://github.com/apache/skywalking-swck/tree/master/operator -version: 0.8.0 +version: 0.9.0 description: Provision and maintain SkyWalking backend components icon: https://raw.githubusercontent.com/apache/skywalking-kubernetes/master/logo/sw-logo-for-chart.jpg sources: diff --git a/chart/operator/README.md b/chart/operator/README.md index 7afa6db..d608575 100644 --- a/chart/operator/README.md +++ b/chart/operator/README.md @@ -44,7 +44,7 @@ The following table lists the configurable parameters of the operator chart and | `.serviceAccountName` | The service account name of operator | `skywalking-swck-controller-manager` | | `.image.repository` | Operator container image name | `docker.io/apache/skywalking-swck` | | `.image.pullPolicy` | Operator container image pull policy | `IfNotPresent` | -| `.image.tag` | Operator container image tag | `v0.8.0` | +| `.image.tag` | Operator container image tag | `v0.9.0` | | `.metrics.service.port` | The port for the operator metrics service | `8443` | | `.webhook.service.port` | The port for the operator web hook service | `9443` | | `.resources.limits.cpu` | The limits of cpu in the operator | `200m` | diff --git a/chart/operator/templates/rbac.yaml b/chart/operator/templates/rbac.yaml index 8075be0..5038697 100644 --- a/chart/operator/templates/rbac.yaml +++ b/chart/operator/templates/rbac.yaml @@ -60,8 +60,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null - name: {{ include "operator.fullname" . | trunc (int (sub 63 (len "-manager-role"))) | printf "%s-manager-role" }} + name: skywalking-swck-manager-role rules: - apiGroups: - certificates.k8s.io @@ -86,18 +85,24 @@ rules: - apiGroups: - "" resources: - - configmaps/status + - events verbs: - - get + - create - patch - - update - apiGroups: - "" resources: - - events + - persistentvolumeclaims + - serviceaccounts + - services verbs: - create + - delete + - get + - list - patch + - update + - watch - apiGroups: - "" resources: @@ -196,6 +201,32 @@ rules: - patch - update - watch +- apiGroups: + - operator.skywalking.apache.org + resources: + - banyandbs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - operator.skywalking.apache.org + resources: + - banyandbs/finalizers + verbs: + - update +- apiGroups: + - operator.skywalking.apache.org + resources: + - banyandbs/status + verbs: + - get + - patch + - update - apiGroups: - operator.skywalking.apache.org resources: diff --git a/test/e2e/expected/endpoint.yaml b/test/e2e/expected/endpoint.yaml new file mode 100644 index 0000000..2f8ef70 --- /dev/null +++ b/test/e2e/expected/endpoint.yaml @@ -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 .}} +- id: {{ b64enc "Your_ApplicationName" }}.1_{{ b64enc "GET:/hello" }} + name: 'GET:/hello' +{{- end}} diff --git a/test/e2e/expected/metrics.yaml b/test/e2e/expected/metrics.yaml new file mode 100644 index 0000000..e26df45 --- /dev/null +++ b/test/e2e/expected/metrics.yaml @@ -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. + +{{- contains . }} +- key: {{ notEmpty .key }} + value: + value: {{ gt .value.value 0 }} + isemptyvalue: false +- key: {{ notEmpty .key }} + value: + value: 0 + isemptyvalue: true +{{- end }} diff --git a/test/e2e/expected/service-apdex.yaml b/test/e2e/expected/service-apdex.yaml new file mode 100644 index 0000000..76fee01 --- /dev/null +++ b/test/e2e/expected/service-apdex.yaml @@ -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. + +{{- contains . }} +- key: {{ notEmpty .key }} + value: + value: 0 + isemptyvalue: true +- key: {{ notEmpty .key }} + value: + value: {{ gt .value.value 0 }} + isemptyvalue: false +{{- end }} diff --git a/test/e2e/expected/swck-demo-service.yaml b/test/e2e/expected/swck-demo-service.yaml new file mode 100644 index 0000000..798857b --- /dev/null +++ b/test/e2e/expected/swck-demo-service.yaml @@ -0,0 +1,26 @@ +# 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 "Your_ApplicationName" }}.1 + name: Your_ApplicationName + group: "" + shortname: "Your_ApplicationName" + layers: + - GENERAL + normal: true +{{- end }} diff --git a/test/e2e/swck/e2e.yaml b/test/e2e/swck/oap-agent-adapter-hpa.yaml similarity index 78% rename from test/e2e/swck/e2e.yaml rename to test/e2e/swck/oap-agent-adapter-hpa.yaml index 0f26e93..68aab9c 100644 --- a/test/e2e/swck/e2e.yaml +++ b/test/e2e/swck/oap-agent-adapter-hpa.yaml @@ -1,3 +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. + setup: env: kind file: ../kind.yaml @@ -51,7 +66,7 @@ setup: - name: Setup oapserver and ui command: | kubectl create namespace skywalking-system - curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.8.0/test/e2e/skywalking-components.yaml | grep -B20 "\-\-\-" | kubectl apply -f - + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/skywalking-components.yaml | grep -B20 "\-\-\-" | kubectl apply -f - wait: - namespace: skywalking-system resource: OAPServer/skywalking-system @@ -59,14 +74,14 @@ setup: - name: Setup java agent demo command: | kubectl label namespace skywalking-system swck-injection=enabled - curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.8.0/test/e2e/demo.yaml | sed 's/oap-service/skywalking-system-oap.skywalking-system/' | kubectl apply -f - + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/demo.yaml | sed 's/oap-service/skywalking-system-oap.skywalking-system/' | kubectl apply -f - wait: - namespace: skywalking-system resource: deployment/demo for: condition=Available - name: Setup the hpa of java agent demo command: | - curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.8.0/test/e2e/hpa-demo.yaml | kubectl apply -f - + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/hpa-demo.yaml | kubectl apply -f - timeout: 20m cleanup: @@ -84,9 +99,9 @@ verify: # verify with retry strategy retry: # max retry count - count: 20 + count: 30 # the interval between two attempts, e.g. 10s, 1m. - interval: 20s + interval: 10s cases: - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name service_cpm --service-name Your_ApplicationName | yq e 'to_entries' - expected: ../expected/hpa-metrics.yaml diff --git a/test/e2e/swck/oap-agent-banyandb.yaml b/test/e2e/swck/oap-agent-banyandb.yaml new file mode 100644 index 0000000..05156ee --- /dev/null +++ b/test/e2e/swck/oap-agent-banyandb.yaml @@ -0,0 +1,113 @@ +# 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. + +setup: + env: kind + file: ../kind.yaml + init-system-environment: ../env + kind: + expose-ports: + - namespace: skywalking-system + resource: service/demo + port: 8085 + - namespace: default + resource: service/default-oap + port: 12800 + - namespace: default + resource: service/banyandb-test-banyandb-grpc + port: 17912 + steps: + - name: Install yq + command: bash test/e2e/setup-e2e-shell/install.sh yq + - name: Install swctl + command: bash test/e2e/setup-e2e-shell/install.sh swctl + - name: Install kubectl + command: bash test/e2e/setup-e2e-shell/install.sh kubectl + - name: Install helm + command: bash test/e2e/setup-e2e-shell/install.sh helm + - name: Install cert-manager + command: | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml + wait: + - namespace: cert-manager + resource: pod + for: condition=Ready + - name: Install operator + command: | + helm dep up chart/operator + helm install operator chart/operator --namespace=skywalking-swck-system \ + --create-namespace \ + --set fullnameOverride=skywalking-swck + wait: + - namespace: skywalking-swck-system + resource: deployment/skywalking-swck-operator + for: condition=Available + - name: label control plane for banyandb affinity test + command: | + kubectl label nodes kind-control-plane storage=banyandb + - name: remove taint on control plane and enable schedule + command: | + kubectl taint nodes kind-control-plane node-role.kubernetes.io/master- + - name: Install banyandb + command: | + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/deploy-banyandb.yaml | kubectl apply -f - + - name: setup oapserver and ui + command: | + kubectl create namespace skywalking-system + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/skywalking-components-with-banyandb.yaml | kubectl apply -f - + wait: + - namespace: default + resource: OAPServer/default + for: condition=Available + - namespace: skywalking-system + resource: UI/skywalking-system + for: condition=Available + - name: Setup java agent demo + command: | + kubectl label namespace skywalking-system swck-injection=enabled + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/demo.yaml | sed 's/oap-service/default-oap.default/' | kubectl apply -f - + wait: + - namespace: skywalking-system + resource: deployment/demo + for: condition=Available + timeout: 20m + +cleanup: + # always never success failure + on: always + +trigger: + action: http + interval: 10s + times: 5 + url: http://${service_demo_host}:${service_demo_8085}/hello + method: GET + +verify: + # verify with retry strategy + retry: + # max retry count + count: 30 + # the interval between two attempts, e.g. 10s, 1m. + interval: 10s + cases: + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql service ls + expected: ../expected/swck-demo-service.yaml + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql metrics linear --name service_cpm --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql endpoint list --keyword=hello --service-name Your_ApplicationName + expected: ../expected/endpoint.yaml + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint-name GET:/hello --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml diff --git a/test/e2e/swck/oap-ui-agent-elasticsearch.yaml b/test/e2e/swck/oap-ui-agent-elasticsearch.yaml new file mode 100644 index 0000000..bc5dde7 --- /dev/null +++ b/test/e2e/swck/oap-ui-agent-elasticsearch.yaml @@ -0,0 +1,111 @@ +# 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. + +setup: + env: kind + file: ../kind.yaml + init-system-environment: ../env + kind: + expose-ports: + - namespace: skywalking-system + resource: service/demo + port: 8085 + - namespace: default + resource: service/default-oap + port: 12800 + - namespace: default + resource: service/es-out + port: 9200 + steps: + - name: Install yq + command: bash test/e2e/setup-e2e-shell/install.sh yq + - name: Install swctl + command: bash test/e2e/setup-e2e-shell/install.sh swctl + - name: Install kubectl + command: bash test/e2e/setup-e2e-shell/install.sh kubectl + - name: Install helm + command: bash test/e2e/setup-e2e-shell/install.sh helm + - name: Install cert-manager + command: | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml + wait: + - namespace: cert-manager + resource: pod + for: condition=Ready + - name: Install operator + command: | + helm dep up chart/operator + helm install operator chart/operator --namespace=skywalking-swck-system \ + --create-namespace \ + --set fullnameOverride=skywalking-swck + wait: + - namespace: skywalking-swck-system + resource: deployment/skywalking-swck-operator + for: condition=Available + - name: setup elasticsearch + command: | + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/deploy-elasticsearch.yaml | kubectl apply -f - + kubectl rollout status --watch --timeout=120s statefulset/es + - name: setup storage(use the external type) + command: | + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/external-storage.yaml | kubectl apply -f - + - name: setup oapserver and ui + command: | + kubectl create namespace skywalking-system + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/skywalking-components-with-storage.yaml | kubectl apply -f - + wait: + - namespace: default + resource: OAPServer/default + for: condition=Available + - namespace: skywalking-system + resource: UI/skywalking-system + for: condition=Available + - name: Setup java agent demo + command: | + kubectl label namespace skywalking-system swck-injection=enabled + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/demo.yaml | sed 's/oap-service/default-oap.default/' | kubectl apply -f - + wait: + - namespace: skywalking-system + resource: deployment/demo + for: condition=Available + timeout: 20m + +cleanup: + # always never success failure + on: always + +trigger: + action: http + interval: 10s + times: 5 + url: http://${service_demo_host}:${service_demo_8085}/hello + method: GET + +verify: + # verify with retry strategy + retry: + # max retry count + count: 30 + # the interval between two attempts, e.g. 10s, 1m. + interval: 10s + cases: + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql service ls + expected: ../expected/swck-demo-service.yaml + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql metrics linear --name service_cpm --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql endpoint list --keyword=hello --service-name Your_ApplicationName + expected: ../expected/endpoint.yaml + - query: swctl --display yaml --base-url=http://${service_default_oap_host}:${service_default_oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint-name GET:/hello --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml diff --git a/test/e2e/swck/oap-ui-agent-oapserverconfig.yaml b/test/e2e/swck/oap-ui-agent-oapserverconfig.yaml new file mode 100644 index 0000000..d93630e --- /dev/null +++ b/test/e2e/swck/oap-ui-agent-oapserverconfig.yaml @@ -0,0 +1,130 @@ +# 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. + +setup: + env: kind + file: ../kind.yaml + init-system-environment: ../env + kind: + expose-ports: + - namespace: skywalking-system + resource: service/demo + port: 8085 + - namespace: skywalking-system + resource: service/skywalking-system-oap + port: 12800 + - namespace: skywalking-system + resource: service/songs + port: 80 + steps: + - name: Install yq + command: bash test/e2e/setup-e2e-shell/install.sh yq + - name: Install swctl + command: bash test/e2e/setup-e2e-shell/install.sh swctl + - name: Install kubectl + command: bash test/e2e/setup-e2e-shell/install.sh kubectl + - name: Install helm + command: bash test/e2e/setup-e2e-shell/install.sh helm + - name: Install cert-manager + command: | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml + wait: + - namespace: cert-manager + resource: pod + for: condition=Ready + - name: Install operator + command: | + helm dep up chart/operator + helm install operator chart/operator --namespace=skywalking-swck-system \ + --create-namespace \ + --set fullnameOverride=skywalking-swck + wait: + - namespace: skywalking-swck-system + resource: deployment/skywalking-swck-operator + for: condition=Available + - name: setup oapserver and ui + command: | + kubectl create namespace skywalking-system + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/skywalking-components.yaml | kubectl apply -f - + wait: + - namespace: skywalking-system + resource: OAPServer/skywalking-system + for: condition=Available + - namespace: skywalking-system + resource: UI/skywalking-system + for: condition=Available + - name: setup java agent demo(test for dynamic configuration) + command: | + kubectl label namespace skywalking-system swck-injection=enabled + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/demo.yaml | sed 's/oap-service/skywalking-system-oap.skywalking-system/' | kubectl create -f - + wait: + - namespace: skywalking-system + resource: deployment/demo + for: condition=Available + - name: setup oapserverconfig(static configuration) + command: | + export oap_podname=$(kubectl get pod -lapp=oap -n skywalking-system -o jsonpath='{.items[*].metadata.name}') + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/oapserverconfig-demo.yaml | kubectl apply -f - + - name: wait the old pod teminated + command: | + while kubectl get pod $oap_podname -n skywalking-system > /dev/null; \ + do \ + sleep 0.1; \ + done + - name: setup java agent demo(test for static configuration) + command: | + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/resource.yaml | sed 's/oap-service/skywalking-system-oap.skywalking-system/' | kubectl create -f - + wait: + - namespace: skywalking-system + resource: deployment/songs-deployment + for: condition=Available + - name: setup oapserverdynamicconfig(dynamic configuration) + command: | + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/oapserverdynamicconfig-demo.yaml | sed 's/default: 0.1/default: 500/' | kubectl apply -f - + timeout: 20m + +cleanup: + # always never success failure + on: always + +trigger: + action: http + interval: 5s + times: 5 + url: http://${service_demo_host}:${service_demo_8085}/hello + method: GET + +verify: + # verify with retry strategy + retry: + # max retry count + count: 30 + # the interval between two attempts, e.g. 10s, 1m. + interval: 10s + cases: + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql service ls + expected: ../expected/swck-demo-service.yaml + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name service_cpm --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql endpoint list --keyword=hello --service-name Your_ApplicationName + expected: ../expected/endpoint.yaml + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint-name GET:/hello --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml + # test oapsever's static configuration + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name=log_count_info --instance-name=songs --service-name=agent::songs | yq e 'to_entries' - + expected: ../expected/metrics.yaml + # test oapsever's dynamic configuration + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name=service_apdex --service-name=Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/service-apdex.yaml diff --git a/test/e2e/swck/oap-ui-agent-satellite.yaml b/test/e2e/swck/oap-ui-agent-satellite.yaml new file mode 100644 index 0000000..5eff1be --- /dev/null +++ b/test/e2e/swck/oap-ui-agent-satellite.yaml @@ -0,0 +1,104 @@ +# 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. + +setup: + env: kind + file: ../kind.yaml + init-system-environment: ../env + kind: + expose-ports: + - namespace: skywalking-system + resource: service/demo + port: 8085 + - namespace: skywalking-system + resource: service/skywalking-system-oap + port: 12800 + steps: + - name: Install yq + command: bash test/e2e/setup-e2e-shell/install.sh yq + - name: Install swctl + command: bash test/e2e/setup-e2e-shell/install.sh swctl + - name: Install kubectl + command: bash test/e2e/setup-e2e-shell/install.sh kubectl + - name: Install helm + command: bash test/e2e/setup-e2e-shell/install.sh helm + - name: Install cert-manager + command: | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.9.1/cert-manager.yaml + wait: + - namespace: cert-manager + resource: pod + for: condition=Ready + - name: Install operator + command: | + helm dep up chart/operator + helm install operator chart/operator --namespace=skywalking-swck-system \ + --create-namespace \ + --set fullnameOverride=skywalking-swck + wait: + - namespace: skywalking-swck-system + resource: deployment/skywalking-swck-operator + for: condition=Available + - name: setup oapserver and ui + command: | + kubectl create namespace skywalking-system + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/skywalking-components-with-satellite.yaml | kubectl apply -f - + wait: + - namespace: skywalking-system + resource: OAPServer/skywalking-system + for: condition=Available + - namespace: skywalking-system + resource: UI/skywalking-system + for: condition=Available + - namespace: skywalking-system + resource: Satellite/skywalking-system + for: condition=Available + - name: Setup java agent demo + command: | + kubectl label namespace skywalking-system swck-injection=enabled + curl https://raw.githubusercontent.com/apache/skywalking-swck/v0.9.0/test/e2e/demo.yaml | sed 's/oap-service/skywalking-system-satellite.skywalking-system/' | kubectl apply -f - + wait: + - namespace: skywalking-system + resource: deployment/demo + for: condition=Available + timeout: 20m + +cleanup: + # always never success failure + on: always + +trigger: + action: http + interval: 30s + times: 30 + url: http://${service_demo_host}:${service_demo_8085}/hello + method: GET + +verify: + # verify with retry strategy + retry: + # max retry count + count: 30 + # the interval between two attempts, e.g. 10s, 1m. + interval: 10s + cases: + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql service ls + expected: ../expected/swck-demo-service.yaml + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name service_cpm --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql endpoint list --keyword=hello --service-name Your_ApplicationName + expected: ../expected/endpoint.yaml + - query: swctl --display yaml --base-url=http://${service_skywalking_system_oap_host}:${service_skywalking_system_oap_12800}/graphql metrics linear --name endpoint_cpm --endpoint-name GET:/hello --service-name Your_ApplicationName | yq e 'to_entries' - + expected: ../expected/metrics.yaml