This is an automated email from the ASF dual-hosted git repository.

wusheng 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 fea9ce3  Replace e2e cases to e2e-v2: Alarm (#8036)
fea9ce3 is described below

commit fea9ce366c93c578408800b2b880228d0a39f810
Author: wankai123 <[email protected]>
AuthorDate: Fri Oct 29 09:25:48 2021 +0800

    Replace e2e cases to e2e-v2: Alarm (#8036)
---
 .github/workflows/e2e.alarm.yaml                   | 13 ++--
 CHANGES.md                                         |  1 +
 test/e2e-v2/cases/alarm/alarm-cases.yaml           | 41 +++++++++++++
 test/e2e-v2/cases/alarm/alarm-settings.yml         | 49 +++++++++++++++
 test/e2e-v2/cases/alarm/es/docker-compose.yml      | 59 ++++++++++++++++++
 test/e2e-v2/cases/alarm/es/e2e.yaml                | 47 +++++++++++++++
 test/e2e-v2/cases/alarm/expected/service.yml       | 20 +++++++
 .../expected/silence-after-graphql-critical.yml    | 65 ++++++++++++++++++++
 .../alarm/expected/silence-after-graphql-warn.yml  | 65 ++++++++++++++++++++
 .../cases/alarm/expected/silence-after-webhook.yml | 70 ++++++++++++++++++++++
 .../expected/silence-before-graphql-critical.yml   | 42 +++++++++++++
 .../alarm/expected/silence-before-graphql-warn.yml | 42 +++++++++++++
 .../alarm/expected/silence-before-webhook.yml      | 44 ++++++++++++++
 test/e2e-v2/cases/alarm/h2/docker-compose.yml      | 60 +++++++++++++++++++
 test/e2e-v2/cases/alarm/h2/e2e.yaml                | 47 +++++++++++++++
 .../e2e-v2/cases/alarm/influxdb/docker-compose.yml | 57 ++++++++++++++++++
 test/e2e-v2/cases/alarm/influxdb/e2e.yaml          | 47 +++++++++++++++
 test/e2e-v2/cases/alarm/mysql/docker-compose.yml   | 62 +++++++++++++++++++
 test/e2e-v2/cases/alarm/mysql/e2e.yaml             | 47 +++++++++++++++
 .../e2e-v2/cases/alarm/postgres/docker-compose.yml | 61 +++++++++++++++++++
 test/e2e-v2/cases/alarm/postgres/e2e.yaml          | 47 +++++++++++++++
 21 files changed, 981 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/e2e.alarm.yaml b/.github/workflows/e2e.alarm.yaml
index 4404e8c..4cc4ee5 100644
--- a/.github/workflows/e2e.alarm.yaml
+++ b/.github/workflows/e2e.alarm.yaml
@@ -38,9 +38,12 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        storage: ['h2', 'mysql', 'es6', 'es7', 'influxdb', 'postgres']
-    env:
-      SW_STORAGE: ${{ matrix.storage }}
+        config-file:
+          - alarm/h2/e2e.yaml
+          - alarm/es/e2e.yaml
+          - alarm/mysql/e2e.yaml
+          - alarm/influxdb/e2e.yaml
+          - alarm/postgres/e2e.yaml
     steps:
       - uses: actions/checkout@v2
         with:
@@ -49,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.alarm.AlarmE2E
+          config-file: ${{ matrix.config-file }}
diff --git a/CHANGES.md b/CHANGES.md
index 4f4e3cd..5c57ebd 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -27,6 +27,7 @@ Release Notes.
   - Client-JS
   - Istio: ALS, Metrics
   - TTL
+  - Alarm
 * Support JDK 16 and 17.
 
 #### OAP Server
diff --git a/test/e2e-v2/cases/alarm/alarm-cases.yaml 
b/test/e2e-v2/cases/alarm/alarm-cases.yaml
new file mode 100644
index 0000000..d2189f4
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/alarm-cases.yaml
@@ -0,0 +1,41 @@
+# 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.
+
+  cases:
+    # service list
+    - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql service ls
+      expected: expected/service.yml
+    # before silence alarm list WARNING,receivers=lisi
+    - query: |
+        sleep 5;
+        swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags 
level=WARNING,receivers=lisi
+      expected: expected/silence-before-graphql-warn.yml
+    # before silence alarm list level=CRITICAL,receivers=zhangsan
+    - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags 
level=CRITICAL,receivers=zhangsan
+      expected: expected/silence-before-graphql-critical.yml
+    # before silence webhook
+    - query: curl -s -XPOST http://${provider_host}:${provider_9090}/alarm/read
+      expected: expected/silence-before-webhook.yml
+    # after silence alarm list WARNING,receivers=lisi
+    - query: |
+        sleep 30;
+        swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags 
level=WARNING,receivers=lisi
+      expected: expected/silence-after-graphql-warn.yml
+    # after silence alarm list level=CRITICAL,receivers=zhangsan
+    - query: swctl --display yaml 
--base-url=http://${oap_host}:${oap_12800}/graphql alarm ls --tags 
level=CRITICAL,receivers=zhangsan
+      expected: expected/silence-after-graphql-critical.yml
+    # after silence webhook
+    - query: curl -s -XPOST http://${provider_host}:${provider_9090}/alarm/read
+      expected: expected/silence-after-webhook.yml
diff --git a/test/e2e-v2/cases/alarm/alarm-settings.yml 
b/test/e2e-v2/cases/alarm/alarm-settings.yml
new file mode 100755
index 0000000..f765d40
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/alarm-settings.yml
@@ -0,0 +1,49 @@
+# 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.
+
+rules:
+  # service response time > 10ms
+  service_resp_time_rule:
+    metrics-name: service_resp_time
+    op: ">"
+    threshold: 10
+    period: 10
+    count: 1
+    silence-period: 1
+    message: Response time of service {name} is more than 10ms in 1 minutes of 
last 10 minutes.
+    only-as-condition: false
+    tags:
+      level: WARNING
+      receivers: lisi
+  # service sla > 1%
+  service_sla_rule:
+    metrics-name: service_sla
+    op: ">"
+    threshold: 100
+    period: 10
+    count: 1
+    silence-period: 1
+    message: Successful rate of service {name} is more than 1% in 1 minutes of 
last 10 minutes
+    only-as-condition: true
+composite-rules:
+  comp_rule:
+    expression: service_resp_time_rule && service_sla_rule
+    message: Service {name} response time is more than 10ms and sla is more 
than 1%.
+    tags:
+      level: CRITICAL
+      receivers: zhangsan
+
+webhooks:
+  - http://provider:9090/alarm/receive
diff --git a/test/e2e-v2/cases/alarm/es/docker-compose.yml 
b/test/e2e-v2/cases/alarm/es/docker-compose.yml
new file mode 100644
index 0000000..4e5862e
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/es/docker-compose.yml
@@ -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.
+
+version: '2.1'
+
+services:
+  es:
+    image: elastic/elasticsearch:7.15.0
+    expose:
+      - 9200
+    networks:
+      - e2e
+    environment:
+      - discovery.type=single-node
+    healthcheck:
+      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  oap:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: oap
+    environment:
+      SW_STORAGE: elasticsearch
+      SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
+    ports:
+      - 12800
+    depends_on:
+      es:
+        condition: service_healthy
+    volumes:
+      - ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
+
+  provider:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: provider
+    ports:
+      - 9090
+    depends_on:
+      oap:
+        condition: service_healthy
+
+networks:
+  e2e:
diff --git a/test/e2e-v2/cases/alarm/es/e2e.yaml 
b/test/e2e-v2/cases/alarm/es/e2e.yaml
new file mode 100644
index 0000000..47c55f2
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/es/e2e.yaml
@@ -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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 1200
+  init-system-environment: ../../../script/env
+  steps:
+    - name: install yq
+      command: bash test/e2e-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
+
+trigger:
+  action: http
+  interval: 3s
+  times: 10
+  url: http://${provider_host}:${provider_9090}/users
+  method: POST
+  body: '{"id":"123","name":"skywalking"}'
+  headers:
+    "Content-Type": "application/json"
+
+verify:
+  retry:
+    count: 20
+    interval: 3s
+  cases:
+    - includes:
+        - ../alarm-cases.yaml
diff --git a/test/e2e-v2/cases/alarm/expected/service.yml 
b/test/e2e-v2/cases/alarm/expected/service.yml
new file mode 100644
index 0000000..3a33348
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/service.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.
+
+{{- contains . }}
+- id: {{ b64enc "e2e-service-provider" }}.1
+  name: e2e-service-provider
+  group: ""
+{{- end }}
diff --git 
a/test/e2e-v2/cases/alarm/expected/silence-after-graphql-critical.yml 
b/test/e2e-v2/cases/alarm/expected/silence-after-graphql-critical.yml
new file mode 100644
index 0000000..691546f
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/silence-after-graphql-critical.yml
@@ -0,0 +1,65 @@
+# 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.
+
+msgs:
+  {{- contains .msgs }}
+  - starttime: {{ gt .starttime 0 }}
+    scope: Service
+    id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    message: Service e2e-service-provider response time is more than 10ms and 
sla is more than 1%.
+    tags:
+      - key: level
+        value: CRITICAL
+      - key: receivers
+        value: zhangsan
+    events:
+      {{- contains .events }}
+      - uuid: {{ notEmpty .uuid}}
+        source:
+          service: e2e-service-provider
+          serviceinstance: ""
+          endpoint: ""
+        name: Alarm
+        type: ""
+        message: {{ notEmpty .message}}
+        parameters: []
+        starttime: {{ gt .starttime 0 }}
+        endtime: {{ gt .endtime 0 }}
+      {{- end }}
+  - starttime: {{ gt .starttime 0 }}
+    scope: Service
+    id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    message: Service e2e-service-provider response time is more than 10ms and 
sla is more than 1%.
+    tags:
+      - key: level
+        value: CRITICAL
+      - key: receivers
+        value: zhangsan
+    events:
+      {{- contains .events }}
+      - uuid: {{ notEmpty .uuid }}
+        source:
+          service: e2e-service-provider
+          serviceinstance: ""
+          endpoint: ""
+        name: Alarm
+        type: ""
+        message: {{ notEmpty .message}}
+        parameters: []
+        starttime: {{ gt .starttime 0 }}
+        endtime: {{ gt .endtime 0 }}
+      {{- end }}
+  {{- end }}
+total: {{ gt .total 1 }}
diff --git a/test/e2e-v2/cases/alarm/expected/silence-after-graphql-warn.yml 
b/test/e2e-v2/cases/alarm/expected/silence-after-graphql-warn.yml
new file mode 100644
index 0000000..2ee4d5b
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/silence-after-graphql-warn.yml
@@ -0,0 +1,65 @@
+# 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.
+
+msgs:
+  {{- contains .msgs }}
+  - starttime: {{ gt .starttime 0 }}
+    scope: Service
+    id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    message: Response time of service e2e-service-provider is more than 10ms 
in 1 minutes of last 10 minutes.
+    tags:
+      - key: level
+        value: WARNING
+      - key: receivers
+        value: lisi
+    events:
+      {{- contains .events }}
+      - uuid: {{ notEmpty .uuid}}
+        source:
+          service: e2e-service-provider
+          serviceinstance: ""
+          endpoint: ""
+        name: Alarm
+        type: ""
+        message: {{ notEmpty .message}}
+        parameters: []
+        starttime: {{ gt .starttime 0 }}
+        endtime: {{ gt .endtime 0 }}
+      {{- end }}
+  - starttime: {{ gt .starttime 0 }}
+    scope: Service
+    id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    message: Response time of service e2e-service-provider is more than 10ms 
in 1 minutes of last 10 minutes.
+    tags:
+      - key: level
+        value: WARNING
+      - key: receivers
+        value: lisi
+    events:
+      {{- contains .events }}
+      - uuid: {{ notEmpty .uuid }}
+        source:
+          service: e2e-service-provider
+          serviceinstance: ""
+          endpoint: ""
+        name: Alarm
+        type: ""
+        message: {{ notEmpty .message}}
+        parameters: []
+        starttime: {{ gt .starttime 0 }}
+        endtime: {{ gt .endtime 0 }}
+      {{- end }}
+  {{- end }}
+total: {{ gt .total 1 }}
diff --git a/test/e2e-v2/cases/alarm/expected/silence-after-webhook.yml 
b/test/e2e-v2/cases/alarm/expected/silence-after-webhook.yml
new file mode 100644
index 0000000..f1d0f03
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/silence-after-webhook.yml
@@ -0,0 +1,70 @@
+# 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.
+
+messages:
+  {{- contains .messages }}
+  - scopeId: 1
+    scope: SERVICE
+    name: e2e-service-provider
+    id0: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    id1: ""
+    ruleName: service_resp_time_rule
+    alarmMessage: Response time of service e2e-service-provider is more than 
10ms in 1 minutes of last 10 minutes.
+    startTime: {{ gt .startTime 0 }}
+    tags:
+      - key: level
+        value: WARNING
+      - key: receivers
+        value: lisi
+  - scopeId: 1
+    scope: SERVICE
+    name: e2e-service-provider
+    id0: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    id1: ""
+    ruleName: comp_rule
+    alarmMessage: Service e2e-service-provider response time is more than 10ms 
and sla is more than 1%.
+    startTime: {{ gt .startTime 0 }}
+    tags:
+      - key: level
+        value: CRITICAL
+      - key: receivers
+        value: zhangsan
+  - scopeId: 1
+    scope: SERVICE
+    name: e2e-service-provider
+    id0: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    id1: ""
+    ruleName: service_resp_time_rule
+    alarmMessage: Response time of service e2e-service-provider is more than 
10ms in 1 minutes of last 10 minutes.
+    startTime: {{ gt .startTime 0 }}
+    tags:
+      - key: level
+        value: WARNING
+      - key: receivers
+        value: lisi
+  - scopeId: 1
+    scope: SERVICE
+    name: e2e-service-provider
+    id0: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    id1: ""
+    ruleName: comp_rule
+    alarmMessage: Service e2e-service-provider response time is more than 10ms 
and sla is more than 1%.
+    startTime: {{ gt .startTime 0 }}
+    tags:
+      - key: level
+        value: CRITICAL
+      - key: receivers
+        value: zhangsan
+  {{- end }}
diff --git 
a/test/e2e-v2/cases/alarm/expected/silence-before-graphql-critical.yml 
b/test/e2e-v2/cases/alarm/expected/silence-before-graphql-critical.yml
new file mode 100644
index 0000000..59d75c9
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/silence-before-graphql-critical.yml
@@ -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.
+
+msgs:
+  {{- contains .msgs }}
+  - starttime: {{ gt .starttime 0 }}
+    scope: Service
+    id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    message: Service e2e-service-provider response time is more than 10ms and 
sla is more than 1%.
+    tags:
+      - key: level
+        value: CRITICAL
+      - key: receivers
+        value: zhangsan
+    events:
+      {{- contains .events }}
+      - uuid: {{ notEmpty .uuid}}
+        source:
+          service: e2e-service-provider
+          serviceinstance: ""
+          endpoint: ""
+        name: Alarm
+        type: ""
+        message: {{ notEmpty .message}}
+        parameters: []
+        starttime: {{ gt .starttime 0 }}
+        endtime: {{ gt .endtime 0 }}
+      {{- end }}
+  {{- end }}
+total: 1
diff --git a/test/e2e-v2/cases/alarm/expected/silence-before-graphql-warn.yml 
b/test/e2e-v2/cases/alarm/expected/silence-before-graphql-warn.yml
new file mode 100644
index 0000000..080228e
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/silence-before-graphql-warn.yml
@@ -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.
+
+msgs:
+  {{- contains .msgs }}
+  - starttime: {{ gt .starttime 0 }}
+    scope: Service
+    id: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    message: Response time of service e2e-service-provider is more than 10ms 
in 1 minutes of last 10 minutes.
+    tags:
+      - key: level
+        value: WARNING
+      - key: receivers
+        value: lisi
+    events:
+      {{- contains .events }}
+      - uuid: {{ notEmpty .uuid}}
+        source:
+          service: e2e-service-provider
+          serviceinstance: ""
+          endpoint: ""
+        name: Alarm
+        type: ""
+        message: {{ notEmpty .message}}
+        parameters: []
+        starttime: {{ gt .starttime 0 }}
+        endtime: {{ gt .endtime 0 }}
+      {{- end }}
+  {{- end }}
+total: 1
diff --git a/test/e2e-v2/cases/alarm/expected/silence-before-webhook.yml 
b/test/e2e-v2/cases/alarm/expected/silence-before-webhook.yml
new file mode 100644
index 0000000..c076fd0
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/expected/silence-before-webhook.yml
@@ -0,0 +1,44 @@
+# 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.
+
+messages:
+  {{- contains .messages }}
+  - scopeId: 1
+    scope: SERVICE
+    name: e2e-service-provider
+    id0: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    id1: ""
+    ruleName: service_resp_time_rule
+    alarmMessage: Response time of service e2e-service-provider is more than 
10ms in 1 minutes of last 10 minutes.
+    startTime: {{ gt .startTime 0 }}
+    tags:
+      - key: level
+        value: WARNING
+      - key: receivers
+        value: lisi
+  - scopeId: 1
+    scope: SERVICE
+    name: e2e-service-provider
+    id0: ZTJlLXNlcnZpY2UtcHJvdmlkZXI=.1
+    id1: ""
+    ruleName: comp_rule
+    alarmMessage: Service e2e-service-provider response time is more than 10ms 
and sla is more than 1%.
+    startTime: {{ gt .startTime 0 }}
+    tags:
+      - key: level
+        value: CRITICAL
+      - key: receivers
+        value: zhangsan
+  {{- end }}
diff --git a/test/e2e-v2/cases/alarm/h2/docker-compose.yml 
b/test/e2e-v2/cases/alarm/h2/docker-compose.yml
new file mode 100644
index 0000000..822d057
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/h2/docker-compose.yml
@@ -0,0 +1,60 @@
+# 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:
+  h2db:
+    build:
+      context: .
+      dockerfile: ../../../script/dockerfile/Dockerfile.h2
+    networks:
+      - e2e
+    expose:
+      - 1521
+    healthcheck:
+      test: [ "CMD", "sh", "-c", "nc -z 127.0.0.1 1521" ]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  oap:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: oap
+    environment:
+      SW_STORAGE: h2
+      SW_STORAGE_H2_URL: jdbc:h2:tcp://h2db:1521/skywalking-oap-db
+      SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
+    ports:
+      - 12800
+    depends_on:
+      h2db:
+        condition: service_healthy
+    volumes:
+      - ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
+
+  provider:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: provider
+    ports:
+      - 9090
+    depends_on:
+      oap:
+        condition: service_healthy
+
+networks:
+  e2e:
diff --git a/test/e2e-v2/cases/alarm/h2/e2e.yaml 
b/test/e2e-v2/cases/alarm/h2/e2e.yaml
new file mode 100644
index 0000000..47c55f2
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/h2/e2e.yaml
@@ -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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 1200
+  init-system-environment: ../../../script/env
+  steps:
+    - name: install yq
+      command: bash test/e2e-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
+
+trigger:
+  action: http
+  interval: 3s
+  times: 10
+  url: http://${provider_host}:${provider_9090}/users
+  method: POST
+  body: '{"id":"123","name":"skywalking"}'
+  headers:
+    "Content-Type": "application/json"
+
+verify:
+  retry:
+    count: 20
+    interval: 3s
+  cases:
+    - includes:
+        - ../alarm-cases.yaml
diff --git a/test/e2e-v2/cases/alarm/influxdb/docker-compose.yml 
b/test/e2e-v2/cases/alarm/influxdb/docker-compose.yml
new file mode 100644
index 0000000..7b0e356
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/influxdb/docker-compose.yml
@@ -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.
+
+version: '2.1'
+
+services:
+  influxdb:
+    image: influxdb:1.7.9
+    expose:
+      - 8086
+    networks:
+      - e2e
+    healthcheck:
+      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8086"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  oap:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: oap
+    environment:
+      SW_STORAGE: influxdb
+      SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
+    ports:
+      - 12800
+    depends_on:
+      influxdb:
+        condition: service_healthy
+    volumes:
+      - ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
+
+  provider:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: provider
+    ports:
+      - 9090
+    depends_on:
+      oap:
+        condition: service_healthy
+
+networks:
+  e2e:
diff --git a/test/e2e-v2/cases/alarm/influxdb/e2e.yaml 
b/test/e2e-v2/cases/alarm/influxdb/e2e.yaml
new file mode 100644
index 0000000..47c55f2
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/influxdb/e2e.yaml
@@ -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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 1200
+  init-system-environment: ../../../script/env
+  steps:
+    - name: install yq
+      command: bash test/e2e-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
+
+trigger:
+  action: http
+  interval: 3s
+  times: 10
+  url: http://${provider_host}:${provider_9090}/users
+  method: POST
+  body: '{"id":"123","name":"skywalking"}'
+  headers:
+    "Content-Type": "application/json"
+
+verify:
+  retry:
+    count: 20
+    interval: 3s
+  cases:
+    - includes:
+        - ../alarm-cases.yaml
diff --git a/test/e2e-v2/cases/alarm/mysql/docker-compose.yml 
b/test/e2e-v2/cases/alarm/mysql/docker-compose.yml
new file mode 100644
index 0000000..f8dfa37
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/mysql/docker-compose.yml
@@ -0,0 +1,62 @@
+# 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:
+  mysql:
+    image: mysql/mysql-server:8.0.13
+    networks:
+      - e2e
+    expose:
+      - 3306
+    environment:
+      - MYSQL_ROOT_PASSWORD=root@1234
+      - MYSQL_DATABASE=swtest
+      - MYSQL_ROOT_HOST=%
+    healthcheck:
+      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  oap:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: oap
+    environment:
+      SW_STORAGE: mysql
+      SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
+    entrypoint: ['sh', '-c', 'apk add --no-cache bash && /download-mysql.sh && 
/skywalking/docker-entrypoint.sh']
+    ports:
+      - 12800
+    depends_on:
+      mysql:
+        condition: service_healthy
+    volumes:
+      - ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
+
+  provider:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: provider
+    ports:
+      - 9090
+    depends_on:
+      oap:
+        condition: service_healthy
+
+networks:
+  e2e:
diff --git a/test/e2e-v2/cases/alarm/mysql/e2e.yaml 
b/test/e2e-v2/cases/alarm/mysql/e2e.yaml
new file mode 100644
index 0000000..47c55f2
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/mysql/e2e.yaml
@@ -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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 1200
+  init-system-environment: ../../../script/env
+  steps:
+    - name: install yq
+      command: bash test/e2e-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
+
+trigger:
+  action: http
+  interval: 3s
+  times: 10
+  url: http://${provider_host}:${provider_9090}/users
+  method: POST
+  body: '{"id":"123","name":"skywalking"}'
+  headers:
+    "Content-Type": "application/json"
+
+verify:
+  retry:
+    count: 20
+    interval: 3s
+  cases:
+    - includes:
+        - ../alarm-cases.yaml
diff --git a/test/e2e-v2/cases/alarm/postgres/docker-compose.yml 
b/test/e2e-v2/cases/alarm/postgres/docker-compose.yml
new file mode 100644
index 0000000..11c5f30
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/postgres/docker-compose.yml
@@ -0,0 +1,61 @@
+# 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:
+  postgres:
+    image: postgres:13
+    networks:
+      - e2e
+    expose:
+      - 5432
+    environment:
+      - POSTGRES_PASSWORD=123456
+      - POSTGRES_DB=skywalking
+    healthcheck:
+      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/5432"]
+      interval: 5s
+      timeout: 60s
+      retries: 120
+
+  oap:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: oap
+    environment:
+      SW_STORAGE: postgresql
+      SW_JDBC_URL: "jdbc:postgresql://postgres:5432/skywalking"
+      SW_SEARCHABLE_ALARM_TAG_KEYS: level,receivers
+    ports:
+      - 12800
+    depends_on:
+      postgres:
+        condition: service_healthy
+    volumes:
+      - ../alarm-settings.yml:/skywalking/config/alarm-settings.yml
+
+  provider:
+    extends:
+      file: ../../../script/docker-compose/base-compose.yml
+      service: provider
+    ports:
+      - 9090
+    depends_on:
+      oap:
+        condition: service_healthy
+
+networks:
+  e2e:
diff --git a/test/e2e-v2/cases/alarm/postgres/e2e.yaml 
b/test/e2e-v2/cases/alarm/postgres/e2e.yaml
new file mode 100644
index 0000000..47c55f2
--- /dev/null
+++ b/test/e2e-v2/cases/alarm/postgres/e2e.yaml
@@ -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.
+
+# This file is used to show how to write configuration files and can be used 
to test.
+
+setup:
+  env: compose
+  file: docker-compose.yml
+  timeout: 1200
+  init-system-environment: ../../../script/env
+  steps:
+    - name: install yq
+      command: bash test/e2e-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
+
+trigger:
+  action: http
+  interval: 3s
+  times: 10
+  url: http://${provider_host}:${provider_9090}/users
+  method: POST
+  body: '{"id":"123","name":"skywalking"}'
+  headers:
+    "Content-Type": "application/json"
+
+verify:
+  retry:
+    count: 20
+    interval: 3s
+  cases:
+    - includes:
+        - ../alarm-cases.yaml

Reply via email to