-
Notifications
You must be signed in to change notification settings - Fork 205
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] - Future assertions improvements [KVL-1218] #12294
Conversation
Is the intention to use these new functions in a later changeset? |
Yes, they will be used in the command dedup conformance tests. I wanted to split them up so that it;s easier to review. |
|
||
def optionalAssertion(runs: Boolean, description: String)( | ||
assertions: => Future[_] | ||
)(logger: Logger): Future[_] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a contextualized logger defined in this file, and a logging context passed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, nit: unneeded braces
succeedDeadline: Option[Instant] = None, | ||
)( | ||
test: => Future[V] | ||
)(implicit ec: ExecutionContext, logger: Logger): Future[V] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loggers are not designed to be passed around; you have one per class. If you need context, use ContextualizedLogger
and LoggingContext
.
maxInterval: FiniteDuration, | ||
description: String, | ||
)( | ||
test: => Future[V] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually called twice or is it cached after the first call?
I did a bit of local testing and it seems fine, but I just want to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be in principle, but the code paths are mutually exclusive, so it's not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be called up to maxInterval / delay
, as we need to retry until it either succeeds or the interval expires
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Outdated
Show resolved
Hide resolved
maxInterval: FiniteDuration, | ||
description: String, | ||
)( | ||
test: => Future[V] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be in principle, but the code paths are mutually exclusive, so it's not.
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Outdated
Show resolved
Hide resolved
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Show resolved
Hide resolved
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Outdated
Show resolved
Hide resolved
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Outdated
Show resolved
Hide resolved
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Outdated
Show resolved
Hide resolved
|
||
def optionalAssertion(runs: Boolean, description: String)( | ||
assertions: => Future[_] | ||
)(logger: Logger): Future[_] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, nit: unneeded braces
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Show resolved
Hide resolved
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Show resolved
Hide resolved
...-test-tool/src/main/scala/com/daml/ledger/api/testtool/infrastructure/FutureAssertions.scala
Outdated
Show resolved
Hide resolved
succeedDuration: FiniteDuration, | ||
succeedDeadline: Option[Instant] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
succeedDuration: FiniteDuration, | |
succeedDeadline: Option[Instant] = None, | |
duration: FiniteDuration, | |
until: Option[Instant] = None, |
Also, if you don't need to pass both, consider an Either
.
…/testtool/infrastructure/FutureAssertions.scala Co-authored-by: fabiotudone-da <[email protected]>
I'll be merging this to unblock my follow up PRs and will fix any other comments in a separate PR. |
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.