Skip to content

Commit

Permalink
Merge #1410
Browse files Browse the repository at this point in the history
1410: Testing /network/clock r=piotr-iohk a=piotr-iohk

# Issue Number

#1394

# Overview

- 82b01bc
  address that network/clock is not available on Windows at this stage
  
- 0f7c759
  use pendingOnWindows for network/clock integration test
  
- d49e8de
  revise log error levels

# Comments

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Piotr Stachyra <piotr.stachyra@iohk.io>
  • Loading branch information
iohk-bors[bot] and Piotr Stachyra authored Mar 6, 2020
2 parents f2c0389 + dd07382 commit 9bd4ff8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
3 changes: 2 additions & 1 deletion lib/core-integration/cardano-wallet-core-integration.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-wallet-core-integration
version: 2019.6.24
version: 2020.3.3
synopsis: Core integration test library.
description: Shared core functionality for our integration test suites.
homepage: https://github.com/input-output-hk/cardano-wallet
Expand Down Expand Up @@ -36,6 +36,7 @@ library
, bytestring
, cardano-wallet-cli
, cardano-wallet-core
, cardano-wallet-test-utils
, command
, containers
, cryptonite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import Test.Integration.Framework.DSL
)
import Test.Integration.Framework.TestData
( errMsg404NoEpochNo )
import Test.Utils.Windows
( pendingOnWindows )

import qualified Cardano.Wallet.Api.Link as Link
import qualified Data.Text as T
Expand Down Expand Up @@ -199,15 +201,14 @@ spec = do
HTTP.status404
(errMsg404NoEpochNo (T.unpack maxEpochValue))

it "NETWORK - Can query network clock" $ \ctx ->
eventually "ntp status = available" $ do
it "NETWORK_CLOCK - Can query network clock" $ \ctx -> do
pendingOnWindows "network/clock at this point is not supported on Windows"
eventually "ntp status = (un)available" $ do
r <- request @ApiNetworkClock ctx
Link.getNetworkClock Default Empty
expectResponseCode @IO HTTP.status200 r
verify r
[ expectField (#ntpStatus . #status)
(`shouldBe` NtpSyncingStatusAvailable)
]
expectField (#ntpStatus . #status)
(`shouldBe` NtpSyncingStatusAvailable) r
where
verifyEpochNumWrong
:: Context t
Expand Down
26 changes: 13 additions & 13 deletions lib/core/src/Network/Ntp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,28 @@ instance ToText NtpTrace where
instance DefinePrivacyAnnotation NtpTrace
instance DefineSeverity NtpTrace where
defineSeverity ev = case ev of
NtpTraceRunProtocolSuccess _ -> Debug
NtpTraceSocketOpen _ -> Debug
NtpTraceSocketClosed _ -> Debug
NtpTracePacketSent _ -> Debug
NtpTracePacketReceived _ -> Debug
NtpTraceStartNtpClient -> Info
NtpTraceTriggerUpdate -> Info
NtpTraceRestartDelay _ -> Info
NtpTraceRestartingClient -> Info
NtpTraceClientSleeping -> Info
NtpTraceIOError _ -> Alert
NtpTraceLookupServerFailed _ -> Alert
NtpTraceClientStartQuery -> Info
NtpTraceNoLocalAddr -> Alert
NtpTraceIPv4IPv6NoReplies -> Info
NtpTraceReportPolicyQueryFailed -> Alert
NtpTraceQueryResult _ -> Info
NtpTraceRunProtocolError _ _ -> Alert
NtpTraceRunProtocolNoResult _ -> Info
NtpTraceRunProtocolSuccess _ -> Debug
NtpTraceSocketOpen _ -> Debug
NtpTraceSocketClosed _ -> Debug
NtpTracePacketSent _ -> Debug
NtpTracePacketSentError _ _ -> Alert
NtpTracePacketDecodeError _ _-> Alert
NtpTracePacketReceived _ -> Debug
NtpTraceWaitingForRepliesTimeout _ -> Alert
NtpTraceRunProtocolError _ _ -> Notice
NtpTracePacketSentError _ _ -> Notice
NtpTracePacketDecodeError _ _-> Notice
NtpTraceWaitingForRepliesTimeout _ -> Notice
NtpTraceIOError _ -> Notice
NtpTraceLookupServerFailed _ -> Notice
NtpTraceNoLocalAddr -> Notice
NtpTraceReportPolicyQueryFailed -> Notice

getNtpStatus :: NtpClient -> IO ApiNetworkClock
getNtpStatus client = ntpQueryBlocking client >>= \case
Expand Down
2 changes: 1 addition & 1 deletion lib/test-utils/cardano-wallet-test-utils.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cardano-wallet-test-utils
version: 2019.6.24
version: 2020.3.3
synopsis: Shared utilities for writing unit and property tests.
description: Shared utilities for writing unit and property tests.
homepage: https://github.com/input-output-hk/cardano-wallet
Expand Down
3 changes: 2 additions & 1 deletion nix/.stack.nix/cardano-wallet-core-integration.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nix/.stack.nix/cardano-wallet-test-utils.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,10 @@ paths:
tags: ["Network"]
summary: Clock
description: |
<p align="right">status: <strong>under development</strong></p>
<p align="right">status: <strong>stable</strong></p>
> ⚠️ At this stage the endpoint is not supported on Windows platform. Invoked on
> Windows will return `status: unavailable` in the response message.
responses: *responsesGetNetworkClock

/network/parameters/{epochId}:
Expand Down

0 comments on commit 9bd4ff8

Please sign in to comment.