Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make sure storage tests use unique stores #1433

Merged
merged 2 commits into from
Sep 6, 2024
Merged

Conversation

anitarua
Copy link
Contributor

@anitarua anitarua commented Sep 5, 2024

Should use the WithStore helper function to create a unique store for each storage control plane test.

Creates single shared store for storage data plane tests using a beforeAll and is cleaned up using an afterAll.

Remove the "should successfully make two of the same requests after 5s retry timeout" test, which I added to test an edge case while developing the storage retry strategy, but it is no longer relevant after collapsing the fixed timeout interceptor into the retry interceptor.

@anitarua anitarua marked this pull request as ready for review September 5, 2024 19:36
@anitarua anitarua requested a review from a team September 5, 2024 19:36
Comment on lines +260 to +266
beforeAll(async () => {
await createStoreIfNotExists(storageClient, integrationTestStoreName);
});

afterAll(async () => {
await deleteStoreIfExists(storageClient, integrationTestStoreName);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a beforeAll and afterAll to create a shared store that can be used by storage data plane tests. this will prevent leaked stores and ensure minimal creation of stores where possible.

switch (putBytesResponse.type) {
case StoragePutResponse.Success: {
// WithStore creates a store then deletes it
await WithStore(storageClient, storeName, async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used WithStore in this test to make it more concise, but it does the same thing as before (calls create, create, delete)

}, `expected NotFound, received ${getResponse.toString()}`);
expect(getResponse.value()).toBeUndefined();
});
});
it('should return store not found error for deleting a store that doesnt exist', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved 'should return store not found error for deleting a store that doesnt exist' to the storage control plane block of tests

await sleep(5000);
// Data plane tests should use the shared integration test store
// with the BeforeAll setup and AfterAll teardown
describe('#store get put and delete', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the storage data plane tests should be in this describe block and should use the shared store with unique keys

@anitarua anitarua requested a review from cprice404 September 5, 2024 21:51
@anitarua anitarua merged commit db6b2dd into main Sep 6, 2024
13 checks passed
@anitarua anitarua deleted the fix-storage-tests branch September 6, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants