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
1 change: 1 addition & 0 deletions .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ jobs:
API_KEY: '${{ secrets.PRIVATE_KEY }}'
BASE64_SEALED_RESULT: '${{ secrets.BASE64_SEALED_RESULT }}'
BASE64_KEY: '${{ secrets.BASE64_KEY }}'
RULESET_ID: '${{ secrets.RULESET_ID }}'
10 changes: 6 additions & 4 deletions tests/functional-tests/functionalTests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ async function validateRulesetEvaluationForBlock(client, start, end) {

const expected = {
ruleset_id,
rule_id: 'r_PMwGXkWtG20KZn',
rule_id: event.rule_action?.rule_id,
rule_expression: 'incognito',
type: 'block',
status_code: 403,
headers: [{ name: 'Content-Type', value: 'application/json' }],
body: '{"message": "Incognito not allowed"}',
}

assert.match(String(event.rule_action?.rule_id), /^r_/)
assert.deepStrictEqual(event.rule_action, expected)

console.log('Ruleset evaluation with `block` works!')
Expand All @@ -105,12 +106,13 @@ async function validateRulesetEvaluationForAllow(client, start, end) {

const expected = {
ruleset_id,
rule_id: 'r_OPnYaU9dKEke9X',
rule_id: event.rule_action?.rule_id,
rule_expression: 'environment_id != "non-an-environment-id"',
type: 'allow',
request_header_modifications: { remove: [], set: [{ name: 'X-Allowed', value: 'true' }], append: [] },
}

assert.match(String(event.rule_action?.rule_id), /^r_/)
assert.deepStrictEqual(event.rule_action, expected)

console.log('Ruleset evaluation with `allow` works!')
Expand Down Expand Up @@ -167,8 +169,8 @@ async function main() {
try {
const client = createClient()
const end = Date.now()
// API rejects start times older than 90 days; use 89 days to stay within the limit.
const start = end - 89 * 24 * 60 * 60 * 1000
// Stay within the 30-day search window of workspaces on the default data retention.
const start = end - 29 * 24 * 60 * 60 * 1000

const recent = await getRecentEvents(client, start, end)
const [firstEvent] = recent.events
Expand Down
Loading