Skip to content

Conversation

megha-narayanan
Copy link

Various integration tests and misc tests that require previous PR3 changes to be merged. note this PR includes ONLY the test files, none of the actual files, so the tests don't actually run yet. It is merely to be able to view the tests.

Copy link

changeset-bot bot commented Jul 23, 2025

⚠️ No Changeset found

Latest commit: 198407a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines +104 to +106
undefined, // No active log pollers for this test
undefined, // No toggle start times for this test
mockPrinter,

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous arguments passed to
constructor of class SocketHandlerService
.
mockGetSandboxState,
mockBackendClient,
'amplify-backend', // Default namespace
mockRegionFetcher, // Pass the mock region fetcher

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous argument passed to
constructor of class ResourceService
.
Comment on lines +169 to +172
new Map(),
new Map(),
printer,
mockLambdaClient, // Pass the mock Lambda client

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous arguments passed to
constructor of class SocketHandlerService
.
Comment on lines +112 to +114
undefined, // No active log pollers for this test
undefined, // No toggle start times for this test
mockPrinter,

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning

Superfluous arguments passed to
constructor of class SocketHandlerService
.
Comment on lines +152 to +153
undefined,
this.logger,

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning test

Superfluous arguments passed to
constructor of class ResourceService
.
Comment on lines +165 to +167
undefined,
undefined,
this.logger,

Check warning

Code scanning / CodeQL

Superfluous trailing arguments Warning test

Superfluous arguments passed to
constructor of class SocketHandlerService
.
Copy link
Member

@svidgen svidgen left a comment

Choose a reason for hiding this comment

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

Not going deep at all on this one right now, as there are still health check failures. But, this one could use at least a quick pass to confirm tests match their descriptions.

Comment on lines +174 to +176
// Simulate corrupted storage by mocking loadResources to throw an error
const originalLoadResources = storageManager.loadResources;
storageManager.loadResources = () => null;
Copy link
Member

Choose a reason for hiding this comment

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

Comments says "throw an error". Replacement function (which seems like maybe it should be a mock?) simply returns null.

Comment on lines +191 to +192
// Should recover by returning an empty array instead of crashing
assert.deepStrictEqual(resources, []);
Copy link
Member

Choose a reason for hiding this comment

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

The test description is pretty lofty -- touting "recovery" from "corruption." (Sounds heroic, actually!) But, this test doesn't really demonstrate recovery. It seems to demonstrate that a null result from loadResources equates to an empty array "return" value.

Comment on lines +178 to +186
// Set up a promise that will resolve when we receive resources
const resourcesReceived = new Promise<unknown>((resolve) => {
clientSocket.on(SOCKET_EVENTS.SAVED_RESOURCES, (data) => {
resolve(data);
});
});

// Request saved resources
clientSocket.emit(SOCKET_EVENTS.GET_SAVED_RESOURCES);
Copy link
Member

Choose a reason for hiding this comment

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

Seeing this socket request/response pattern makes me wish we'd invested a little time in creating a protocol to handle these details under the hood -- to make these requests look more like "normal" RPC calls.

In lieu of that, for now, can we at lest rename "response" type event names to clearly indicate that they are in fact in response to a "call". Would be interested in a naming convention proposal. E.g., a straw man:

  1. {METHOD_NAME}_REQUEST
  2. {METHOD_NANE}_RESPONSE
  3. STREAM_{NAME}_CHUNK

Or something like that.

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.

2 participants