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

Unify semantic test between sandbox IT and Ledger API Test Tool #1171

Merged
merged 12 commits into from
May 28, 2019

Conversation

gleber-da
Copy link
Contributor

@gleber-da gleber-da commented May 15, 2019

See individual commit messages.

Prepares for #146

Pull Request Checklist

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@gleber-da gleber-da force-pushed the ledger-api-it-remote-fixture branch 4 times, most recently from f3525bf to d4ace1c Compare May 20, 2019 14:51
@gleber-da gleber-da marked this pull request as ready for review May 20, 2019 14:51
Copy link
Contributor

@gabor-aranyossy gabor-aranyossy left a comment

Choose a reason for hiding this comment

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

Looks good in general, had a few comments.

@@ -56,6 +56,19 @@ object LedgerFactories {

}

def createRemoteApiProxyResource(config: PlatformApplications.Config)(
implicit esf: ExecutionSequencerFactory): Resource[LedgerContext.SingleChannelContext] = {
require(config.remoteApiEndpoint.isDefined, "config.remoteApiEndpoint has to be set")
Copy link
Contributor

Choose a reason for hiding this comment

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

you could assert on the host and port too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why? They are not Option[*], hence should have meaningful values. In worst case we'd have 0 as port and empty string as host, which will just make it fail at runtime.

Copy link
Contributor

Choose a reason for hiding this comment

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

host can be empty and port can be negative. It's nit-picking, I just thought I mention it.

@gleber-da gleber-da force-pushed the ledger-api-it-remote-fixture branch from d4ace1c to 1a19b7b Compare May 22, 2019 09:04
@gleber-da gleber-da force-pushed the ledger-api-it-remote-fixture branch 5 times, most recently from 284eb40 to 5f1d443 Compare May 27, 2019 14:03
@gleber-da gleber-da force-pushed the ledger-api-it-remote-fixture branch from 5f1d443 to 18fdc26 Compare May 27, 2019 15:06
Copy link
Contributor

@gabor-aranyossy gabor-aranyossy left a comment

Choose a reason for hiding this comment

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

I had few new minor comments, but it looks good!


private def repeatChar(char: Char, n: Int) = List.fill(n)(char).mkString

val depth: AtomicInteger = new AtomicInteger(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not private?

Copy link
Contributor

Choose a reason for hiding this comment

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

the Atomic* semantics does not seem to be required here. Does a Reporter need to be thread-safe?

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 assumed it had to, but it does not have to. No other implementation I could find was using concurrency synchronization.

Copy link
Contributor

Choose a reason for hiding this comment

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

in that case I'd just use a var to avoid confusion

final val ansiYellow = "\u001b[33m"
final val ansiRed = "\u001b[31m"

private def repeatChar(char: Char, n: Int) = List.fill(n)(char).mkString
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: this can be really inefficient. Consider creating an array and a String from it via: String.valueOf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gleber added 10 commits May 28, 2019 11:28
This is in preparation for using Sandbox IT suite as part of the Ledger API Test
Tool.
This is no longer necessary for the tool and it does not scale with the types of
tests in the suite.
This makes sure that a server getting stuck will get detected by a test, instead
of ignoring it and potentially allowing the server to linger.
It manges parties and command identifier to include a unique (random) suffix in
all ledger-commited identifiers. This allows the test to run against a Ledger
API without reseting it.
…uite.

This reuses the scenario runner test code from the IT suite, instead of
reimplementing it. This should be a no-op (except for tests reports formatting).
This makrs Akka threads to be daemons, hence forcing them to be closed at the
end of Ledger Api Test Tool.
This quites Ledger API Test Tool output.
@gleber-da gleber-da force-pushed the ledger-api-it-remote-fixture branch from 18fdc26 to 802b275 Compare May 28, 2019 09:28
gleber added 2 commits May 28, 2019 11:31
This addresses two needs:
- avoid using buggy scalatest test reporter;
- pretty-prints test results prettier.
@gleber-da gleber-da force-pushed the ledger-api-it-remote-fixture branch from 802b275 to 0375ea9 Compare May 28, 2019 09:31
@mergify mergify bot merged commit 40ce2b9 into master May 28, 2019
@mergify mergify bot deleted the ledger-api-it-remote-fixture branch May 28, 2019 09:59
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.

4 participants