Skip to content

Fix web server release test due to mismatch in Request ID #3665

@acuarica

Description

@acuarica

The following release test for Web Server consistently fails (you can run it using acceptancetest:release_ws)

$ npm run acceptancetest:release_ws
[...]
 1) RPC Server Acceptance Tests
       Acceptance tests
         @web-socket-batch-request Batch Requests
           given WS_BATCH_REQUESTS_ENABLED=true are set
             @release Should submit batch requests to WS server using Standard Web Socket and retrieve batch responses:

      AssertionError: expected [ { result: '0x129', …(2) }, …(4) ] to deeply equal [ { result: '0x129', …(2) }, …(4) ]
      + expected - actual

         }
         {
           "error": {
             "code": -32602
      -      "message": "[Request ID: d79be947-5fcb-44e8-8ee9-5c04847cb26c] Invalid parameter 0: Expected 0x prefixed string representing the address (20 bytes), value: 0xhedera"
      +      "message": "[Request ID: 7c3b0dc6-f7b7-4219-9f64-672488ec10e8] Invalid parameter 0: Expected 0x prefixed string representing the address (20 bytes), value: 0xhedera"
           }
           "id": 1
           "jsonrpc": "2.0"
         }
      
      at Suite.<anonymous> (packages/ws-server/tests/acceptance/batchRequest.spec.ts:80:38)
      at Generator.next (<anonymous>)
      at fulfilled (packages/ws-server/tests/acceptance/batchRequest.spec.ts:6:58)
[...]

The problem seems to be just the comparison. Note that the messages only differ in the Request ID (which makes sense) given how the test work

it(`@release Should submit batch requests to WS server using Standard Web Socket and retrieve batch responses`, async () => {
// call batch request
const batchResponses = await WsTestHelper.sendRequestToStandardWebSocket(METHOD_NAME, batchRequests);
// individually process each request
const promises: any = [];
batchRequests.forEach((request: any) => {
promises.push(WsTestHelper.sendRequestToStandardWebSocket(request.method, request.params));
});
const individualResponses = await Promise.all(promises);
expect(batchResponses).to.deep.eq(individualResponses);
});

A possible solution would just to mask the Request ID when a given response is an error.

Note

I believe this test is not being run on CI, that's why we didn't detect it earlier.

Metadata

Metadata

Assignees

Labels

internalFor changes that affect the project's internal workings but not its outward-facing functionality.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions