Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add E2E test and enhance simulator flexibility #330

Merged
merged 8 commits into from
Nov 18, 2024

Conversation

georgi-l95
Copy link
Contributor

@georgi-l95 georgi-l95 commented Nov 7, 2024

Description:
This PR adds new functionality aimed at making the simulator a better and more flexible test driver for E2E tests. It achieves this by:

  • Adding a new StreamStatus data object, which collects and stores information about the recently published/consumed blocks, as well as the latest statuses.
  • Exposing the necessary methods to make this usable in other modules, primarily the E2E Tests module.
  • Adding a new E2E test that covers the positive scenario where the simulator sends blocks to the Block Node, which responds with the correct response.
  • Adds a new CustomThreadPoolExecutor to handle simulator threads, for now I'm just handling thrown errors, but in the future we might extend, depending on our needs.

Related issue(s):

Fixes #186

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@georgi-l95 georgi-l95 added Tests issue related to enhancing the tests Simulator Issue related to Block Stream Simulator labels Nov 7, 2024
@georgi-l95 georgi-l95 added this to the 0.2.0 milestone Nov 7, 2024
@georgi-l95 georgi-l95 self-assigned this Nov 7, 2024
@georgi-l95 georgi-l95 linked an issue Nov 7, 2024 that may be closed by this pull request
@georgi-l95 georgi-l95 force-pushed the 186-e2e-tests-endpoint-accessibility branch from f0361e4 to 5eff4f5 Compare November 11, 2024 10:21
@georgi-l95 georgi-l95 marked this pull request as ready for review November 11, 2024 15:38
@georgi-l95 georgi-l95 requested review from a team as code owners November 11, 2024 15:38
@georgi-l95 georgi-l95 changed the title test: E2E Tests: Endpoint Behaviour test: Add E2E test and enhance simulator flexibility Nov 11, 2024
Copy link
Contributor

@ata-nas ata-nas left a comment

Choose a reason for hiding this comment

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

This is my first review, I will need to do another one for sure. Generally looks good, but I have a couple of questions and a couple of concerns, also a few nit picks.

General comment:
Can you please consider to add javadocs to the tests describing what they aim to achieve? Will make them a lot easier to review and for us to know their purpose in order to validate them?

Copy link
Contributor

@mattp-swirldslabs mattp-swirldslabs left a comment

Choose a reason for hiding this comment

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

Nice work, I like seeing all this new test coverage! I added one suggestion.

Signed-off-by: georgi-l95 <[email protected]>

feat: add stream status object

Signed-off-by: georgi-l95 <[email protected]>

chore: refactor and refine

Signed-off-by: georgi-l95 <[email protected]>

feat: additional refactor

Signed-off-by: georgi-l95 <[email protected]>

test: fix unit tests

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>

test: fix unit test

Signed-off-by: georgi-l95 <[email protected]>

chore: cleanup

Signed-off-by: georgi-l95 <[email protected]>

test: unit test

Signed-off-by: georgi-l95 <[email protected]>

test: unit tests

Signed-off-by: georgi-l95 <[email protected]>

address feedback

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
@georgi-l95 georgi-l95 force-pushed the 186-e2e-tests-endpoint-accessibility branch from 0f4fe61 to 6723a79 Compare November 14, 2024 16:31
Copy link
Contributor

@ata-nas ata-nas left a comment

Choose a reason for hiding this comment

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

@georgi-l95 looks good, but the thread pool requires some changes as the current implementation will still silence exceptions.

Signed-off-by: georgi-l95 <[email protected]>
Copy link
Contributor

@ata-nas ata-nas left a comment

Choose a reason for hiding this comment

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

Looks great! Good job @georgi-l95!

Copy link
Contributor

@rbarkerSL rbarkerSL left a comment

Choose a reason for hiding this comment

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

Approval applies to .gitignore

@georgi-l95 georgi-l95 merged commit 46ad591 into main Nov 18, 2024
14 checks passed
@georgi-l95 georgi-l95 deleted the 186-e2e-tests-endpoint-accessibility branch November 18, 2024 18:33
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.62%. Comparing base (2e4d26b) to head (b4d0ef5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #330      +/-   ##
============================================
+ Coverage     94.05%   94.62%   +0.57%     
- Complexity      300      316      +16     
============================================
  Files            68       69       +1     
  Lines          1177     1228      +51     
  Branches         82       84       +2     
============================================
+ Hits           1107     1162      +55     
+ Misses           57       55       -2     
+ Partials         13       11       -2     
Files with missing lines Coverage Δ
...a/com/hedera/block/common/utils/Preconditions.java 100.00% <100.00%> (ø)
...edera/block/simulator/BlockStreamSimulatorApp.java 93.75% <100.00%> (+1.44%) ⬆️
...dera/block/simulator/config/data/StreamStatus.java 100.00% <100.00%> (ø)
...ck/simulator/grpc/PublishStreamGrpcClientImpl.java 96.07% <100.00%> (+0.72%) ⬆️
...ra/block/simulator/grpc/PublishStreamObserver.java 100.00% <100.00%> (ø)
.../block/simulator/metrics/SimulatorMetricTypes.java 100.00% <100.00%> (ø)
...dera/block/simulator/mode/CombinedModeHandler.java 100.00% <100.00%> (ø)
...dera/block/simulator/mode/ConsumerModeHandler.java 100.00% <100.00%> (ø)
...era/block/simulator/mode/PublisherModeHandler.java 100.00% <100.00%> (+7.69%) ⬆️
---- 🚨 Try these New Features:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Simulator Issue related to Block Stream Simulator Tests issue related to enhancing the tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E2E Tests: Endpoint Accessibility
4 participants