Skip to content

test: Remove sinon clock dependency to unblock the CI pipeline#1624

Merged
danieljbruce merged 9 commits intomainfrom
just-pick-failing-readrow-test
Jun 25, 2025
Merged

test: Remove sinon clock dependency to unblock the CI pipeline#1624
danieljbruce merged 9 commits intomainfrom
just-pick-failing-readrow-test

Conversation

@danieljbruce
Copy link
Contributor

Description

Two days ago the system tests suddenly started failing on main even though no changes were made to the codebase. In the tests, the line of code that says clock.runAll(); would wait for all the events to be emitted and processed by the client library so that all the variables used in assertion checks would have the right values and the assertion checks would pass. Suddenly the clock.runAll(); line of code doesn't wait for the events to be processed by the client library so the assertion checks fail. It also seems that even when the assertion checks are omitted the test passes, but the events still don't get processed.

The test framework is changed so that we don't rely on the sinon clock dependency anymore because an update to this dependency seems to have broke the test. Instead, we do all the assertion checks when an error or end event passes through the client library and reaches the test runner since this is when we were doing the assertion checks before anyway when the sinon clock was working properly.

Impact

Now system tests will pass so we can develop on nodejs-bigtable again.

Testing

Modified a test. This doesn't reduce test coverage. It just removes the dependency on the sinon clock.

Additional Information

Before these changes 9 of the tests would fail. The eventemitter was emitting the events, but for some reason the events were never reaching the chunk transformer in the client library.

@danieljbruce danieljbruce requested a review from a team June 25, 2025 16:01
@danieljbruce danieljbruce requested a review from a team as a code owner June 25, 2025 16:01
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigtable Issues related to the googleapis/nodejs-bigtable API. labels Jun 25, 2025
@danieljbruce danieljbruce requested a review from feywind June 25, 2025 17:23
toFake: [
'setTimeout',
'clearTimeout',
'setImmediate',
Copy link
Contributor

Choose a reason for hiding this comment

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

It's possible you could just remove setImmediate and clearImmediate here (and also probably nextTick) and that would also fix it. I seem to remember having troubles with this same issue on Pub/Sub, now that you mention it, because they started hooking these by default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had tried emptying this array earlier and it didn't work for some reason. Also, now I'm getting a strange error that says "Exception during run: SyntaxError[ @/Users/djbruce/Documents/Programming/nodejs-bigtable/build/system-test/app-profile.js ]: Unexpected token '||='" so I think I'll leave this as is to unblock the CI, but I am willing to revisit it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's a sample of this change at main...sinon-timers-2. The tests still seem to fail. I wonder what the actual issue with the timer really is and why it is preventing the emitted event from being received.


tests.forEach(test => {
it(test.name, () => {
it(test.name, (done: mocha.Done) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to avoid the extra mocha dependency, you can also just do done => { here. TS will figure it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a good idea. I'll do this in a separate PR to unblock CI ASAP.

@danieljbruce danieljbruce merged commit 4d1652d into main Jun 25, 2025
20 of 23 checks passed
@danieljbruce danieljbruce deleted the just-pick-failing-readrow-test branch June 25, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the googleapis/nodejs-bigtable API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants