Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions grafana/synthetics/shared/dmtrHealth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import http from 'k6/http'
import { check } from 'k6'
import { check, fail } from 'k6'

export default function () {
const DMTR_API_KEY = '${api_key}'
Expand All @@ -17,9 +17,17 @@ export default function () {
console.log('Response status:', res.status)
console.log('Response body:', res.body)

check(res, {
// Update assertion dashboard based on response
const ok = check(res, {
'status is 200': (r) => r.status === 200,
'body is not empty': (r) => (r.body || '').length > 0,
'body says OK': (r) => (r.body || '').trim().toUpperCase() === 'OK',
'body says OK': (r) => {
const body = typeof r.body === 'string' ? r.body : String.fromCharCode.apply(null, new Uint8Array(r.body))
return body.trim().toUpperCase() === 'OK'
},
})

if (!ok) {
const body = typeof res.body === 'string' ? res.body : String.fromCharCode.apply(null, new Uint8Array(res.body))
fail(`Health check failed: status=$${res.status}, body=$${body}`)
}
}
13 changes: 10 additions & 3 deletions grafana/synthetics/shared/ogmiosQueryNetworkTip.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ export default function () {
console.log('Received:', data)
const json = JSON.parse(data)

check(json,
const ok = check(json,
{
'has result': (r) => r.result !== undefined,
'result has slot': (r) => r.result?.slot > 0,
'method is queryNetwork/tip': (r) => r.method === 'queryNetwork/tip'
})

if (!ok) {
socket.close()
return fail('queryNetwork/tip message check failed')
}
socket.close()
})

Expand All @@ -42,8 +46,11 @@ export default function () {
})
})

check(response,
const ok = check(response,
{
'status is 101': (r) => r && r.status === 101
})
if (!ok) {
return fail('WebSocket connection check failed')
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ terraform {
}
grafana = {
source = "grafana/grafana"
version = ">= 2.9.0"
version = ">= 4.17.0"
}
random = {
source = "hashicorp/random"
Expand Down