-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: initial run command * chore: cleanup
- Loading branch information
Showing
6 changed files
with
145 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
const list = require('./list') | ||
const info = require('./info') | ||
const run = require('./run') | ||
|
||
module.exports = { | ||
list, | ||
info | ||
info, | ||
run, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const consola = require('consola') | ||
const YAML = require('yaml') | ||
const { checks } = require('../../services/api') | ||
const { print } = require('../../services/utils') | ||
|
||
async function runCheck(checkName = '') { | ||
try { | ||
const rawChecks = await checks.getAllLocal(checkName) | ||
const parsedChecks = rawChecks.map((rawCheck) => YAML.parse(rawCheck)) | ||
const selectedCheck = parsedChecks.filter( | ||
(check) => check.name === checkName | ||
) | ||
const results = await checks.run(selectedCheck) | ||
if (results.status === 202) { | ||
print(' Check successfully submitted') | ||
} | ||
} catch (err) { | ||
consola.error(err) | ||
} | ||
} | ||
|
||
module.exports = runCheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,85 @@ url: https://jsonplaceholder.typicode.com/users | |
` | ||
} | ||
|
||
const defaultCheckTemplate = () => { | ||
return `checkType: BROWSER | ||
name: 'example' | ||
frequency: 10 | ||
activated: true | ||
muted: false | ||
doubleCheck: true | ||
locations: | ||
- eu-central-1 | ||
- eu-west-3 | ||
script: |- | ||
const { chromium } = require("playwright") | ||
const expect = require("expect") | ||
// Start a browser session | ||
const browser = await chromium.launch() | ||
const page = await browser.newPage() | ||
// Go to a page. This waits till the 'load' event by default | ||
await page.goto("https://google.com/") | ||
// Assert a specific page item to be present | ||
const title = await page.title() | ||
expect(title).toBe("Google") | ||
// Snap a screenshot | ||
await page.screenshot({ path: "screen.png", fullScreen: false }) | ||
// Close the session | ||
await browser.close() | ||
alertSettings: | ||
muted: false | ||
escalationType: RUN_BASED | ||
runBasedEscalation: | ||
failedRunThreshold: 1 | ||
timeBasedEscalation: | ||
minutesFailingThreshold: 5 | ||
reminders: | ||
amount: 0 | ||
interval: 5 | ||
sslCertificates: | ||
enabled: true | ||
alertThreshold: 30 | ||
useGlobalAlertSettings: true | ||
alertChannelSubscriptions: | ||
- activated: true | ||
alertChannelId: 4 | ||
alertChannel: | ||
id: 4 | ||
type: EMAIL | ||
config: | ||
address: [email protected] | ||
accountId: e46106d8-e382-4d1f-8182-9d63983ed6d4 | ||
created_at: '2021-07-01T10:22:10.559Z' | ||
updated_at: | ||
sendRecovery: true | ||
sendFailure: true | ||
sendDegraded: false | ||
sslExpiry: false | ||
sslExpiryThreshold: 30 | ||
subscriptions: | ||
- id: 22 | ||
checkId: | ||
alertChannelId: 4 | ||
activated: true | ||
groupId: 6 | ||
check: | ||
checkGroup: | ||
id: 6 | ||
name: Big ol group | ||
environmentVariables: [] | ||
tags: [] | ||
runtimeId: '2020.01' | ||
websocketClientId: 6819de32-7723-421f-b3b1-76004c4ebfef | ||
runLocation: eu-central-1` | ||
} | ||
|
||
module.exports = { | ||
settingsTemplate, | ||
checkTemplate, | ||
defaultCheckTemplate, | ||
} |