-
Notifications
You must be signed in to change notification settings - Fork 217
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
Preliminary integration tests between Jormungandr <-> Network Layer (networkTip
)
#400
Conversation
@@ -63,8 +61,6 @@ instance Exception ErrNetworkUnreachable | |||
data ErrNetworkTip | |||
= ErrNetworkTipNetworkUnreachable ErrNetworkUnreachable | |||
| ErrNetworkTipNotFound | |||
| ErrNetworkTipBlockNotFound (Hash "BlockHeader") | |||
-- ^ The tip-block wasn't found. This would be surprising. |
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.
Not needed. This is in the end, an implementation details which can be seen as NetworkTipNotFound
from the external perspective.
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.
🤔 They are different though. ErrNetworkTipNotFound
is expected to be thrown when the http-bridge is started without the chain. ErrNetworkTipBlockNotFound
means "the impossible just happened".
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.
But they pretty much means the same for us in the end: there's no tip. We won't do anything special when the corresponding block isn't found bit treat that as if there was no tip.
…ation tests with Jormungandr
The prefix is part of the node's configuration file, so it can be changed at will and therefore, hasn't its place in the API definition. Instead, it should be passed alongside the 'BaseUrl' given to the Jormungandr manager
af06b91
to
37d95bb
Compare
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.
lgtm — most pressingly wondering if we shouldn't run jormungandr in-memory
I am also (still?) suspicious/confused about NetworkLayer
error types, but that's not specifically related to this pr
@@ -63,8 +61,6 @@ instance Exception ErrNetworkUnreachable | |||
data ErrNetworkTip | |||
= ErrNetworkTipNetworkUnreachable ErrNetworkUnreachable | |||
| ErrNetworkTipNotFound | |||
| ErrNetworkTipBlockNotFound (Hash "BlockHeader") | |||
-- ^ The tip-block wasn't found. This would be surprising. |
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.
🤔 They are different though. ErrNetworkTipNotFound
is expected to be thrown when the http-bridge is started without the chain. ErrNetworkTipBlockNotFound
means "the impossible just happened".
|
||
-- | A default 'RetryPolicy' with a constant delay, but no longer than 20 |
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.
Seems confusing to say that the "constant delay" "is limited". Lazy suggestion:
-- | A default 'RetryPolicy' with a constant delay, but no longer than 20 | |
-- | A default 'RetryPolicy' with a constant delay, but retries for no longer than 20 |
import Test.Hspec | ||
( Spec, describe, expectationFailure, it ) | ||
|
||
spec :: Spec | ||
spec = describe "cardano-wallet-launcher" $ do | ||
it "Can start launcher against testnet" $ do | ||
removePathForcibly "/tmp/cardano-wallet-jormungandr" |
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.
Should we remove the storage from the Jörmungandr config, to use in-memory instead?
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.
Hmmmm. No. Ideally integration tests reproduce the production setup as close as possible. This means, among othert things, using file based storage.
lib/jormungandr/test/integration/Cardano/Wallet/Jormungandr/NetworkSpec.hs
Show resolved
Hide resolved
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.
LGTM! I am also in favour of using only ErrNetworkTipNotFound
and ignoring ErrNetworkTipBlockNotFound (Hash "BlockHeader")
provided we know for sure the error I write below is eliminated. To my understand we get header hash of tip of block so having the tip means we have header hash of the tip. Nevertheless, basing on my experience when playing extensively with diffusion layer of cardano-sl, something else can pop out. Very rarely, but quite enough to detect it in the tests I encountered the error when calling requestTip
:
BlockNetLogicException: DialogUnexpected "peer sent more than one tip"
Presumably, in new Shelly haskell node it is addressed but if not, we should remember about it when having obscure errors.
@pawel.jakubas @Anviking This |
@Anviking Merging without the comment suggestion (will do in another PR) |
Issue Number
#219
Overview
waitForConnection
to also wait for the network tip to become available.networkTip
Comments