From 60a9d6a7a08c016eae02a6e15c9e1bdaf547254e Mon Sep 17 00:00:00 2001 From: Juraj Uhlar Date: Tue, 17 Nov 2026 16:24:43 +0000 Subject: [PATCH 1/2] test: shorten functional test search window to 29 days Test workspaces on the default data retention reject search start times older than 30 days. The tests only need recent events, so a 29-day window works on any retention. --- tests/functional-tests/functionalTests.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional-tests/functionalTests.mjs b/tests/functional-tests/functionalTests.mjs index a7943f29..d379adf4 100644 --- a/tests/functional-tests/functionalTests.mjs +++ b/tests/functional-tests/functionalTests.mjs @@ -167,8 +167,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 From d84f5b390c7c3b5c4758565b918985035b272177 Mon Sep 17 00:00:00 2001 From: Juraj Uhlar Date: Tue, 17 Nov 2026 17:24:56 +0000 Subject: [PATCH 2/2] test: run ruleset checks in CI without hard-coded rule IDs Pass RULESET_ID to the functional tests and check rule_id by shape, so a recreated ruleset needs only the secret updated. --- .github/workflows/functional_tests.yml | 1 + tests/functional-tests/functionalTests.mjs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/functional_tests.yml b/.github/workflows/functional_tests.yml index 57d1a452..573df3e8 100644 --- a/.github/workflows/functional_tests.yml +++ b/.github/workflows/functional_tests.yml @@ -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 }}' diff --git a/tests/functional-tests/functionalTests.mjs b/tests/functional-tests/functionalTests.mjs index d379adf4..e668240b 100644 --- a/tests/functional-tests/functionalTests.mjs +++ b/tests/functional-tests/functionalTests.mjs @@ -75,7 +75,7 @@ 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, @@ -83,6 +83,7 @@ async function validateRulesetEvaluationForBlock(client, start, end) { 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!') @@ -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!')