-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use hpack and exitcode-stdio-1.0 because detailed-0.9 is not supporte…
…d by hpack
- Loading branch information
Dan Fithian
committed
Dec 19, 2017
1 parent
9423218
commit 4fa6728
Showing
12 changed files
with
299 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
dist | ||
cabal-dev | ||
*.cabal | ||
*.o | ||
*.hi | ||
*.chi | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: datadog | ||
version: '0.3.0.0' | ||
author: Ian Duncan | ||
maintainer: [email protected] | ||
license: MIT | ||
license-file: LICENSE | ||
synopsis: 'Datadog client for Haskell. Supports both the HTTP API and StatsD.' | ||
homepage: 'https://github.com/iand675/datadog' | ||
category: Network | ||
build-type: Simple | ||
|
||
default-extensions: | ||
- ConstraintKinds | ||
- DataKinds | ||
- DeriveDataTypeable | ||
- DeriveGeneric | ||
- EmptyDataDecls | ||
- FlexibleContexts | ||
- FlexibleInstances | ||
- GADTs | ||
- GeneralizedNewtypeDeriving | ||
- LambdaCase | ||
- MultiParamTypeClasses | ||
- NamedFieldPuns | ||
# - NoImplicitPrelude | ||
- NoMonomorphismRestriction | ||
- OverloadedStrings | ||
- PackageImports | ||
- PolyKinds | ||
- QuasiQuotes | ||
- RankNTypes | ||
- RecordWildCards | ||
- ScopedTypeVariables | ||
- StandaloneDeriving | ||
- TemplateHaskell | ||
- TupleSections | ||
- TypeFamilies | ||
- TypeOperators | ||
- ViewPatterns | ||
|
||
ghc-options: | ||
- -Wall | ||
# - -Werror | ||
- -fwarn-tabs | ||
- -O2 | ||
|
||
dependencies: | ||
- aeson | ||
- auto-update | ||
- base | ||
- buffer-builder | ||
- bytestring | ||
- dlist | ||
- http-client | ||
- http-client-tls | ||
- http-types | ||
- lens | ||
- lifted-base | ||
- monad-control | ||
- network | ||
- old-locale | ||
- text | ||
- time | ||
- transformers-base | ||
- unordered-containers | ||
- vector | ||
|
||
library: | ||
source-dirs: src | ||
|
||
tests: | ||
datadog-api-test: | ||
main: Spec.hs | ||
source-dirs: | ||
- test | ||
dependencies: | ||
- base | ||
- Cabal | ||
- exceptions | ||
- hspec | ||
- network | ||
- lens | ||
- random | ||
- text | ||
- time | ||
- datadog |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Test.Hspec (hspec) | ||
|
||
import Test.Network.Datadog (spec) | ||
|
||
main :: IO () | ||
main = hspec spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
module Test.Network.Datadog (tests) where | ||
module Test.Network.Datadog (spec) where | ||
|
||
import Test.Hspec (Spec, describe) | ||
|
||
import Distribution.TestSuite | ||
import qualified Test.Network.Datadog.Check as Check (spec) | ||
import qualified Test.Network.Datadog.Downtime as Downtime (spec) | ||
import qualified Test.Network.Datadog.Event as Event (spec) | ||
import qualified Test.Network.Datadog.Host as Host (spec) | ||
import qualified Test.Network.Datadog.Monitor as Monitor (spec) | ||
import qualified Test.Network.Datadog.StatsD as StatsD (spec) | ||
|
||
import qualified Test.Network.Datadog.StatsD as StatsD (tests) | ||
import qualified Test.Network.Datadog.Check as Check (tests) | ||
import qualified Test.Network.Datadog.Downtime as Downtime (tests) | ||
import qualified Test.Network.Datadog.Event as Event (tests) | ||
import qualified Test.Network.Datadog.Monitor as Monitor (tests) | ||
import qualified Test.Network.Datadog.Host as Host (tests) | ||
|
||
|
||
tests :: IO [Test] | ||
tests = map (\(s,t) -> Group s False t) | ||
<$> mapM (\(s,tm) -> fmap (\t -> (s,t)) tm) | ||
[("StatsD", StatsD.tests) | ||
,("Check", Check.tests) | ||
,("Downtime", Downtime.tests) | ||
,("Event", Event.tests) | ||
,("Host", Host.tests) | ||
,("Monitor", Monitor.tests) | ||
] | ||
spec :: Spec | ||
spec = describe "Datadog spec" $ do | ||
describe "StatsD spec" StatsD.spec | ||
describe "Check spec" Check.spec | ||
describe "Downtime spec" Downtime.spec | ||
describe "Event spec" Event.spec | ||
describe "Host spec" Host.spec | ||
describe "Monitor spec" Monitor.spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,31 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Test.Network.Datadog.Check (tests) where | ||
|
||
|
||
import Control.Concurrent (threadDelay) | ||
import Control.Exception | ||
|
||
import Distribution.TestSuite | ||
|
||
import Network.Datadog (Environment, loadKeysFromEnv, createEnvironment) | ||
import Network.Datadog.Check hiding (tags) | ||
|
||
tests :: IO [Test] | ||
tests = return | ||
[ Test TestInstance { run = testCheckRecord | ||
, name = "Test recording of a status check" | ||
, tags = ["Check"] | ||
, options = [] | ||
, setOption = \_ _ -> Left "" | ||
} | ||
] | ||
|
||
|
||
environment :: IO Environment | ||
environment = createEnvironment =<< loadKeysFromEnv | ||
|
||
|
||
testCheckRecord :: IO Progress | ||
testCheckRecord = do | ||
module Test.Network.Datadog.Check (spec) where | ||
|
||
import Test.Hspec (Spec, describe, it) | ||
|
||
import Network.Datadog (Environment, createEnvironment, loadKeysFromEnv) | ||
import Network.Datadog.Check | ||
( CheckResult (CheckResult) | ||
, CheckStatus (CheckOk) | ||
, checkResultCheck | ||
, checkResultHostName | ||
, checkResultMessage | ||
, checkResultStatus | ||
, checkResultTags | ||
, checkResultTimestamp | ||
, recordCheck | ||
) | ||
|
||
spec :: Spec | ||
spec = it "Records a status check" $ do | ||
let environment :: IO Environment | ||
environment = createEnvironment =<< loadKeysFromEnv | ||
check = CheckResult | ||
{ checkResultCheck = "Datadog Test Check" | ||
, checkResultHostName = "development" | ||
, checkResultStatus = CheckOk | ||
, checkResultTimestamp = Nothing | ||
, checkResultMessage = Nothing | ||
, checkResultTags = [] | ||
} | ||
env <- environment | ||
let check = CheckResult { checkResultCheck = "Datadog Test Check" | ||
, checkResultHostName = "development" | ||
, checkResultStatus = CheckOk | ||
, checkResultTimestamp = Nothing | ||
, checkResultMessage = Nothing | ||
, checkResultTags = [] | ||
} | ||
let computation = const (Finished Pass) <$> const (recordCheck env check) <$> threadDelay 500000 | ||
catch computation (\e -> return $ Finished $ Fail $ show (e :: SomeException)) | ||
recordCheck env check |
Oops, something went wrong.