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

ledger-api-test-tool - Adapt for concurrent conflicts [kvl-1369] #13719

Merged
merged 3 commits into from
May 3, 2022

Conversation

nicu-da
Copy link
Contributor

@nicu-da nicu-da commented Apr 27, 2022

  • Upload dars sequentially to avoid conflicts with dependencies included multiple times in separate dars
  • Leaner assertions for concurrent config submission, this allows the implementation to have more flexibility in the errors it returns

changelog_begin
changelog_end

@nicu-da nicu-da requested review from a team as code owners April 27, 2022 15:04
Copy link
Collaborator

@hubert-da hubert-da left a comment

Choose a reason for hiding this comment

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

I assume that the removed failure assertions are too strict for conformance tests.

@nicu-da
Copy link
Contributor Author

nicu-da commented Apr 28, 2022

I assume that the removed failure assertions are too strict for conformance tests.

Those are my thoughts as well, waiting for the participant team to confirm as well. But considering the purpose of the conformance tests I expect that we would have to modify a few more tests in the future to not be so strict in what they validate, and instead create other type of tests.

Comment on lines -177 to -181
assertGrpcError(
failure,
LedgerApiErrors.Admin.ConfigurationEntryRejected,
Some("Generation mismatch"),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Loosening the assertions here means that we don't assert returned self-service error codes, which is not fine. Why are we doing this? Is this test flaky or prohibitive to extensions?

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 not flaky, but I find that the cost of extending and maintaining this test is more than the value it provides.s

The main change is that on our side this will now return another self-service error as well, and getting to the point where we assert 3 possible return values from a call is definitely a sign of un-maintainable tests.

This leads to the other issue where we misuse conformance tests as integration tests, with the main reasoning behind removing the assertions being the following:

  • From a ledger conformance perspective I would expect that we validate that no two concurrent configurations are accepted with the same generation
  • Self-service error codes are a participant only feature and we should have integration/contract tests that validate the participant output, in a more controlled environment where we can set the expectaction for a single status code instead of defaulting through multiple possible outputs
  • Adding the extract assertion for a possible post-execution conflicts self-service error code to this test case feels like diluting the scope of the test a lot, having assertions that are unrelated with the scope of the test (while the error is triggered in this case, it's only because of conccurrent submission and has no relation to config managemnt itself)

I fully aggree that not testing self service error codes is not something that we should strive for, but at the same time we can't spread out the testing for this feature all throughtout the conformance tests, but it should be done in a more structured mode.

Let me know what are your thoughts on how we would proceed in the future with this type of tests, I'm also more than happy just to add a new possible error code (will at least refactor to assert only error code and not the description message)

Copy link
Contributor

@tudor-da tudor-da May 3, 2022

Choose a reason for hiding this comment

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

Self-service error codes are meant to help the app/client or system operator understand what happened when a request went bad. Aside from a couple of errors that are outside the user's control (overloaded system, serious system errors), most errors are related to a request's structure or timing. Ideally, the error code id should generally identify the problem cause and have additional information (e.g. resource, error message) specialize the error to a specific component/mechanism. So, I wouldn't say that self-service error codes are a participant-only feature.

Looking at this test: it seems we have two possible error codes for the same error condition. Ideally, we should merge them (i.e. only have a CONFIGURATION_GENERATION_MISMATCH). I will look into that.

Happy to sync further on this.

P.S. Is the error code that you need to introduce describing a new error condition or can we reuse and existing one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point that the error codes are not participant only. That makes sense.

The error code is a new one that is triggered by any post-execution conflicts.

nicu-da added 3 commits May 3, 2022 09:30
This allows the implementation to return different errors while validating that just one submission succeeds.
@nicu-da nicu-da force-pushed the nicuda/kvl-1369/adapt_for_post_execution_conflicts branch from d84f0bf to ff478e8 Compare May 3, 2022 09:36
@nicu-da nicu-da enabled auto-merge (squash) May 3, 2022 09:55
@nicu-da nicu-da merged commit a5b002e into main May 3, 2022
@nicu-da nicu-da deleted the nicuda/kvl-1369/adapt_for_post_execution_conflicts branch May 3, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants