hazelcast / hazelcast-nodejs-client

Hazelcast Node.js Client
https://hazelcast.com/clients/node-js/
Apache License 2.0
150 stars 59 forks source link

Fix nearcachedmaptest 2nd attempt [API-1161] #1179

Closed srknzl closed 2 years ago

srknzl commented 2 years ago

Second attempt to fix near cached map test. The test failed again on master during nigthly tests with the same exception.

In order to fix it I removed expectStats call as Metin thinks that it's not needed. Also now I assert that the client does not go to cluster after some point and uses the near cache. I achieve that by adding a spy(a thing that counts call count to a function) to MapProxy.getInternal. NearCachedMapProxy calls MapProxy.getInternal via super.getInternal() only when near cache doesnt not have the entry.

Along with the test I added error stack trace logging to test errors originated from assertTrueEventually since it will be easier to reason test failures.

Example output with my change:

Error: Rejected due to timeout of 3000ms. Errors occurred in order: 

AssertionError: expected 1 to equal 0
    at /var/git/forked/hazelcast-nodejs-client/test/integration/backward_compatible/parallel/map/NearCachedMapTest.js:120:60
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
AssertionError: expected null not to be null
    at /var/git/forked/hazelcast-nodejs-client/test/integration/backward_compatible/parallel/map/NearCachedMapTest.js:121:42

    at Timeout._onTimeout (test/TestUtil.js:88:20)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)

This output is only seen in the test results not in the output, so I don't expect the test duration will increase.

fixes #1177

EDIT: Since public API usage will make the test more resilient to back compat test failure hit count increase is asserted now.

codecov[bot] commented 2 years ago

Codecov Report

Merging #1179 (422d788) into master (65ebdac) will decrease coverage by 0.43%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1179      +/-   ##
==========================================
- Coverage   92.54%   92.10%   -0.44%     
==========================================
  Files         438      438              
  Lines       14512    14512              
  Branches     1086     1086              
==========================================
- Hits        13430    13367      -63     
- Misses        795      851      +56     
- Partials      287      294       +7     
Impacted Files Coverage Δ
src/codec/ClientAuthenticationCustomCodec.ts 42.22% <0.00%> (-33.34%) :arrow_down:
src/network/ConnectionManager.ts 75.35% <0.00%> (-8.46%) :arrow_down:
src/invocation/InvocationService.ts 92.47% <0.00%> (-1.77%) :arrow_down:
src/config/ConfigBuilder.ts 90.13% <0.00%> (-1.10%) :arrow_down:
src/invocation/ClusterService.ts 94.01% <0.00%> (-0.86%) :arrow_down:
src/core/HazelcastError.ts 74.79% <0.00%> (-0.82%) :arrow_down:
src/protocol/ErrorFactory.ts 63.90% <0.00%> (-0.76%) :arrow_down:
src/util/Util.ts 87.89% <0.00%> (-0.64%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 65ebdac...422d788. Read the comment docs.