mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-08 06:28:33 +00:00
* feat(collections): implement sliding window for script request UIDs to manage stale updates - Introduced a bounded sliding window mechanism for tracking recent script request UIDs, allowing for better handling of stale updates from superseded or cancelled requests. - Updated relevant functions to utilize the new `isStaleScriptRequest` utility for improved clarity and maintainability. - Enhanced the persistence logic to ensure that updates from retired requests do not interfere with newer requests, improving data integrity during concurrent operations. - Added comprehensive tests to validate the behavior of the new UID management system and its impact on variable propagation across requests. * refactor(tests): remove outdated test for persistentEnvVariables in runtime tests - Eliminated the test case that checked for the inclusion of persistentEnvVariables in the result, as it is no longer relevant. - Cleaned up the test suite to enhance clarity and maintainability, focusing on relevant assertions for variable management. * refactor(collections): simplify environment persistence logic and remove stale request handling - Updated the `persistActiveEnvironment` and related functions to eliminate the requestUid parameter, streamlining the logic for environment persistence. - Removed outdated checks for stale updates from superseded requests, enhancing clarity and maintainability. - Deleted the `_scriptRequestUids` management code and associated tests, as they are no longer necessary for the current implementation. - Improved the handling of environment updates to ensure accurate state management without stale data interference. * refactor(filesystem): remove unused hasJsExtension function - Deleted the `hasJsExtension` utility function from the filesystem module as it was no longer needed. - Cleaned up the exports to enhance clarity and maintainability of the codebase. * test(network): add unit tests for applyCollectionVarsToCollectionRoot * refactor(ipc, environments): implement file locking for environment updates - Updated the environment persistence logic in both `collection.js` and `workspace-environments.js` to utilize file locking during read and write operations. - This change ensures that concurrent access to environment files is managed safely, preventing potential data corruption and enhancing reliability during updates.
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { test } from '../../../../playwright';
|
|
import { openCollection, selectEnvironment } from '../../../utils/page';
|
|
import { runCollection, validateRunnerResults } from '../../../utils/page/runner';
|
|
|
|
test.describe('Script collection-variable propagation across requests in one runner invocation', () => {
|
|
test('request 2 observes request 1\'s setCollectionVar write', async ({
|
|
pageWithUserData: page
|
|
}) => {
|
|
await openCollection(page, 'collection-var-multi-request-test');
|
|
await selectEnvironment(page, 'Test');
|
|
await runCollection(page, 'collection-var-multi-request-test');
|
|
|
|
// Both requests should pass: req-1 sets counter="1"; req-2 reads counter
|
|
// (must see "1"), records it in seenInReq2, then sets counter="2".
|
|
// If applyCollectionVarsToCollectionRoot didn't propagate the change to
|
|
// collection.root.request.vars.req, req-2's mergeVars would rebuild
|
|
// collectionVariables from the pre-run "0" and req-2's first test would fail.
|
|
await validateRunnerResults(page, {
|
|
totalRequests: 2,
|
|
passed: 2,
|
|
failed: 0
|
|
});
|
|
});
|
|
});
|