Skip to content

[coordinator-test] Remove the need for a real VC#610

Merged
liran-funaro merged 7 commits into
hyperledger:mainfrom
liran-funaro:coordinator-test-no-db
Jun 24, 2026
Merged

[coordinator-test] Remove the need for a real VC#610
liran-funaro merged 7 commits into
hyperledger:mainfrom
liran-funaro:coordinator-test-no-db

Conversation

@liran-funaro

@liran-funaro liran-funaro commented May 25, 2026

Copy link
Copy Markdown
Contributor

Type of change

  • Improvement (improvement to code, performance, etc)
  • Test update

Description

  • Add support for injecting predefined TX status
  • Keep tx execution order for validation in tests
  • Remove the use of a real VC and DB in the coordinator testing

Related issues

@coveralls

coveralls commented May 25, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 91.656% (+0.04%) from 91.62% — liran-funaro:coordinator-test-no-db into hyperledger:main

@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch from 813708c to d364ecd Compare May 25, 2026 13:23
@liran-funaro liran-funaro requested a review from cendhu May 25, 2026 13:23
@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch from d364ecd to c97d8c9 Compare May 26, 2026 08:26

@cendhu cendhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am fine with this change but add unit-test for this mock vcservice as it has some core logic such as MVCC.

@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch 2 times, most recently from c6a0260 to 4a30189 Compare May 27, 2026 10:04
@cendhu

cendhu commented May 27, 2026

Copy link
Copy Markdown
Contributor

@liran-funaro Not sure whether you missed my comment. Please add unit-test for this mock vcservice.

@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch 2 times, most recently from 4a30189 to a3b0294 Compare May 27, 2026 14:04
@liran-funaro liran-funaro marked this pull request as draft May 27, 2026 14:27
@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch from 5269f0c to d549bbc Compare May 31, 2026 12:56
@liran-funaro liran-funaro marked this pull request as ready for review May 31, 2026 12:56
@liran-funaro liran-funaro requested a review from cendhu May 31, 2026 12:56
@liran-funaro

Copy link
Copy Markdown
Contributor Author

@cendhu Added tests

@cendhu cendhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to address two issues with this approach:

  1. Logic Duplication & Correctness: We are duplicating the core logic of vcservice here, which makes me question if the trade-off is worth it. It already allowed two bugs to slip past our coordinator and mock tests. Since correctness is strictly more important than reducing test runtime, we should evaluate these changes carefully to avoid introducing hard-to-detect bugs.
  2. Future Maintenance: When we implement snapshots and checkpoints, I'm concerned we will have to add even more complexity to this mock.

As a general rule, mocks should be kept as simple (or 'dumb') as possible. While I supported this change earlier, I am skeptical about it now.

Comment thread mock/vcservice.go Outdated
Comment thread mock/vcservice.go Outdated
@liran-funaro

Copy link
Copy Markdown
Contributor Author

@cendhu I understand your concern. The motivation is not performance, but test encapsulation.
We don't want VC issues to fail the coordinator.
The alternative is to inject responses manually without really doing the validation. Also, injecting the world-state manually.
This will reduce significantly the mock complexity and can arguably make the tests more explicit as the test will explicitly set the VC behaviour.

@cendhu

cendhu commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

The alternative is to inject responses manually without really doing the validation. Also, injecting the world-state manually. This will reduce significantly the mock complexity and can arguably make the tests more explicit as the test will explicitly set the VC behaviour.

Yes, this sounds interesting and similar to how most mock frameworks work. How can we approach this?

@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch 2 times, most recently from e44d8b1 to 7ae3bdb Compare June 23, 2026 12:49
@liran-funaro liran-funaro requested a review from cendhu June 23, 2026 13:00
@liran-funaro

Copy link
Copy Markdown
Contributor Author

@cendhu I modified the PR according to the discussion in this PR

@cendhu cendhu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. This read much simpler. Thanks for making this change.

Comment thread mock/vcservice_test.go Outdated
Comment thread mock/vcservice_test.go Outdated
Comment thread mock/vcservice.go
Comment thread mock/vcservice_test.go Outdated
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch from 7ae3bdb to a0dfe85 Compare June 24, 2026 11:11
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
@liran-funaro liran-funaro force-pushed the coordinator-test-no-db branch from a0dfe85 to 666249e Compare June 24, 2026 11:12
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
@liran-funaro liran-funaro merged commit 4322e38 into hyperledger:main Jun 24, 2026
16 checks passed
@liran-funaro liran-funaro deleted the coordinator-test-no-db branch June 24, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[coordinator test] Enable verify keys in the mock VC [coordinator test] Use mock VC for all coordinator tests

3 participants