Skip to content

Commit 09a0373

Browse files
committed
added ci check for persistence
1 parent 199be83 commit 09a0373

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/stackhpc.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ jobs:
170170
env:
171171
TESTUSER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
172172

173+
- name: Get timestamp in milliseconds before rebuild
174+
id: timestamp
175+
run: |
176+
echo "TIME_BEFORE_REBUILD=$(date +%s%N | cut -b1-13)" >> $GITHUB_OUTPUT
177+
173178
# - name: Build environment-specific compute image
174179
# id: packer_build
175180
# run: |
@@ -209,6 +214,14 @@ jobs:
209214
. environments/.stackhpc/activate
210215
ansible-playbook -vv ansible/ci/check_grafana.yml
211216
217+
- name: Check Loki Slurm logs persisted through rebuild
218+
run: |
219+
. venv/bin/activate
220+
. environments/.stackhpc/activate
221+
ansible-playbook -vv ansible/ci/check_loki.yml -e "end_timestamp=${{ steps.timestamp.outputs.TIME_BEFORE_REBUILD }} testuser_password=$TESTUSER_PASSWORD"
222+
env:
223+
TESTUSER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
224+
212225
- name: Delete infrastructure
213226
run: |
214227
. venv/bin/activate

ansible/ci/check_loki.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
- hosts: control
2+
gather_facts: no
3+
become: no
4+
tasks:
5+
- name: Get Loki datasource uid
6+
ansible.builtin.uri:
7+
url: http://localhost:{{ grafana_port }}/api/datasources/name/Loki
8+
url_username: 'testuser'
9+
url_password: "{{ testuser_password }}"
10+
follow_redirects: all
11+
register: uid_response
12+
13+
- name: Get Loki logs from before rebuild
14+
vars:
15+
testuser_password: mypassword
16+
ansible.builtin.uri:
17+
url: http://localhost:{{ grafana_port }}/api/ds/query
18+
follow_redirects: all
19+
url_username: testuser
20+
url_password: "{{ testuser_password }}"
21+
method: POST
22+
body_format: json
23+
headers:
24+
Accept: application/json
25+
Content-Type: application/json
26+
# Queries from 20 mins before timestamp to timestamp
27+
body: |
28+
{
29+
"queries":[
30+
{
31+
"expr":"{unit=\"slurmd.service\"} |= ``",
32+
"datasource":{"uid":"{{ uid_response.json.uid }}"},
33+
"format":"time_series"
34+
}],
35+
"from":"{{ end_timestamp | int - 1200000 }}",
36+
"to":"{{ end_timestamp }}"
37+
}
38+
register: log_query_content
39+
40+
- name: Check that logs exist
41+
ansible.builtin.assert:
42+
that: log_query_content.json.results.A.frames[0].data['values'][2] | length > 0

0 commit comments

Comments
 (0)