-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (80 loc) · 2.83 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: yarn
- run: yarn test
integration-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "18"
- run: yarn
- run: yarn compile
- name: Set alert values
run: |
export ALIAS=create-alert-int-test-$(date +%s)
export ALL_VALUES_MESSAGE="Alert created with all values"
export REQUIRED_VALUES_MESSAGE="Alert created with required values"
export DESCRIPTION="alert description"
export SOURCE="create alert integration test"
export RESPONDER="name:NOC:team"
echo "ALERT_ALIAS=$(echo -n $ALIAS)" >> $GITHUB_ENV
echo "ALL_VALUES_MESSAGE=$(echo -n ALL_VALUES_MESSAGE)" >> $GITHUB_ENV
echo "REQUIRED_VALUES_MESSAGE=$(echo -n REQUIRED_VALUES_MESSAGE)" >> $GITHUB_ENV
echo "DESCRIPTION=$(echo -n $DESCRIPTION)" >> $GITHUB_ENV
echo "SOURCE=$(echo -n $SOURCE)" >> $GITHUB_ENV
echo "RESPONDER=$(echo -n $RESPONDER)" >> $GITHUB_ENV
- name: Create OpsGenie Alert with All Values
id: create-alert-all-values
uses: ./
with:
api_key: ${{ secrets.OPSGENIE_API_KEY }}
alias: ${{ env.ALERT_ALIAS }}
message: ${{ env.ALL_VALUES_MESSAGE }}
description: ${{ env.DESCRIPTION }}
source: ${{ env.SOURCE }}
priority: P5
tags: kuku
using_eu_url: false
responders: ${{ env.RESPONDER }}
- name: Assert all values alert created
env:
OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }}
run: |
./.github/workflows/assert_alert_created_with.js \
${{ steps.create-alert-all-values.outputs.request_id }} \
"${{ env.ALL_VALUES_MESSAGE }}" \
${{ env.ALERT_ALIAS }} \
"${{ env.DESCRIPTION }}" \
P5 \
kuku \
"${{ env.SOURCE }}" \
"${{ env.RESPONDER }}"
- name: Create OpsGenie Alert with Required Values
id: create-alert-required-values
uses: ./
with:
api_key: ${{ secrets.OPSGENIE_API_KEY }}
message: ${{ env.REQUIRED_VALUES_MESSAGE }}
- name: Throttle requests to OpsGenie
run: sleep 2
- name: Assert required values alert created
env:
OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }}
run: |
./.github/workflows/assert_alert_created_with.js \
${{ steps.create-alert-required-values.outputs.request_id }} \
"${{ env.REQUIRED_VALUES_MESSAGE }}"