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

Rosetta Tests #1079

Merged
merged 68 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
b874139
initial commit
emilypi Jun 15, 2020
e75d182
Merge branch 'master' into rosetta-tests
emilypi Jun 15, 2020
090986e
fix exports
emilypi Jun 15, 2020
bdff193
Merge branch 'master' into rosetta-tests
emilypi Jun 17, 2020
fda98c0
boilerplate extravaganza
emilypi Jun 17, 2020
c13b9ba
she compiles
emilypi Jun 18, 2020
80e841a
merge master
emilypi Jun 18, 2020
955791a
merge maseter
emilypi Jun 18, 2020
ffd8841
prep
emilypi Jun 18, 2020
6ac6d7d
remove multinode code dupe
emilypi Jun 18, 2020
cd8213a
put back extra dep
emilypi Jun 18, 2020
0ef7169
partition out common code
emilypi Jun 18, 2020
dde28f2
first batch of tests work
emilypi Jun 18, 2020
74ea49a
account balance
emilypi Jun 19, 2020
42d9107
remove target chain
emilypi Jun 19, 2020
74124fd
remove target chain
emilypi Jun 19, 2020
e94ddf8
remove chainweb network
emilypi Jun 19, 2020
e3dd33b
add block stuff
emilypi Jun 19, 2020
fa7a771
implement block tests
emilypi Jun 22, 2020
b73b9b1
merge master
emilypi Jun 22, 2020
b114ff0
add simple checks fro network list/options/status
emilypi Jun 23, 2020
741c334
making progress. TODO's listed
emilypi Jun 23, 2020
d493098
update status test
emilypi Jun 23, 2020
256621d
make options test a little nicer
emilypi Jun 24, 2020
c9bd5ef
fix account balance test
emilypi Jun 24, 2020
1dcc5ff
small changes
emilypi Jun 24, 2020
e6fa205
add async tests for mempool
emilypi Jun 25, 2020
5f7ee94
add fixes to mempool test, keep going on mempool transaction
emilypi Jun 25, 2020
5cfc8c4
Merge branch 'master' into rosetta-tests
emilypi Jun 25, 2020
0c67a2a
remove cruft, finish block tx test
emilypi Jun 26, 2020
2d8ab02
Merge branch 'rosetta-tests' of github.com:kadena-io/chainweb-node in…
emilypi Jun 26, 2020
0225549
add construction submit endpoint test
emilypi Jun 30, 2020
6493ef2
Merge branch 'master' into rosetta-tests
emilypi Jun 30, 2020
efb4500
unnecessary scheduling
emilypi Jun 30, 2020
d632f0f
done for the day
emilypi Jun 30, 2020
9ad98f3
Merge branch 'master' into rosetta-tests
emilypi Jul 3, 2020
45460d1
Merge branch 'master' into rosetta-tests
emilypi Jul 6, 2020
2e36deb
last thing: remeds
emilypi Jul 6, 2020
fb73811
use actual devnet remediations (hash-changing update)
emilypi Jul 6, 2020
8e15889
remove fasttimed cpm payload
emilypi Jul 6, 2020
a099c52
rosetta tests done, TODO: fix the tests broken by using actual remedi…
emilypi Jul 7, 2020
1c7e371
fix pact in proc api test
emilypi Jul 7, 2020
7558a3c
unmask -Werror
emilypi Jul 7, 2020
18bc7dc
pare back some cruft
emilypi Jul 7, 2020
f7b6be1
Merge branch 'master' into rosetta-tests
emilypi Jul 7, 2020
cb0dd1c
clean up module tests
emilypi Jul 7, 2020
f00de17
Merge branch 'rosetta-tests' of github.com:kadena-io/chainweb-node in…
emilypi Jul 7, 2020
c95e9e0
revert coinv2 block height increase
emilypi Jul 7, 2020
5a1450d
revert adding remediation to txs
emilypi Jul 8, 2020
afd67e8
remove hie.yaml
emilypi Jul 8, 2020
cd552ae
revert whitespace changes
emilypi Jul 8, 2020
e0ba6b4
Merge branch 'master' into rosetta-tests
emilypi Jul 8, 2020
ca30b4d
add note about 20-chain upgrades
emilypi Jul 8, 2020
97400fe
bad merge
emilypi Jul 8, 2020
90e0a1f
Merge branch 'master' into rosetta-tests
emilypi Jul 8, 2020
88f94ad
remove comment + whitespace
emilypi Jul 8, 2020
65b00f8
Merge branch 'rosetta-tests' of github.com:kadena-io/chainweb-node in…
emilypi Jul 8, 2020
dda1f2e
Merge branch 'master' into rosetta-tests
emilypi Jul 9, 2020
11a3c35
Merge branch 'master' into rosetta-tests
emilypi Jul 9, 2020
dc04db7
Merge branch 'master' into rosetta-tests
emilypi Jul 9, 2020
dba49b1
fix conflicts
emilypi Jul 9, 2020
7884c6f
Merge branch 'rosetta-tests' of github.com:kadena-io/chainweb-node in…
emilypi Jul 9, 2020
4095877
update header
emilypi Jul 9, 2020
c906aa0
remove some cruft
emilypi Jul 9, 2020
6a2f1a0
Merge branch 'master' into rosetta-tests
emilypi Jul 9, 2020
3697c84
Update test/Chainweb/Test/Rosetta/RestAPI.hs
emilypi Jul 9, 2020
e2cefe9
address linda's comments
emilypi Jul 9, 2020
79ce35d
add note
emilypi Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
prep
  • Loading branch information
emilypi committed Jun 18, 2020
commit ffd88414387d2c22b6e8253c4f727e0739f56e86
113 changes: 66 additions & 47 deletions test/Chainweb/Test/Rosetta/RestAPI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Control.Lens
import Control.Monad.Catch
import Control.Retry

import Data.Aeson hiding ((.=))

import GHC.Natural

import Servant.Client
Expand Down Expand Up @@ -54,43 +56,11 @@ v = FastTimedCPM petersonChainGraph
nodes:: Natural
nodes = 1

type RosettaTest = IO (Time Micros) -> IO ChainwebNetwork -> TestTree

data RosettaTestException
= AccountBalanceFailure String
| BlockTransactionFailure String
| BlockFailure String
| ConstructionMetadataFailure String
| ConstructionSubmitFailure String
| MempoolTransactionFailure String
| MempoolFailure String
| NetworkListFailure String
| NetworkOptionsFailure String
| NetworkStatusFailure String
deriving Show

instance Exception RosettaTestException


nid :: NetworkId
nid = NetworkId
{ _networkId_blockchain = undefined
, _networkId_network = "fastTimedCPM"
, _networkId_subNetworkId = undefined
}

aid :: AccountId
aid = AccountId
{ _accountId_address = "sender00"
, _accountId_subAccount = Nothing
, _accountId_metadata = undefined
}

-- -------------------------------------------------------------------------- --
-- Test Tree

tests :: RocksDb -> ScheduledTest
tests rdb = testGroupSch "Chainweb.Test.Rosetta" go
tests :: RocksDb -> TestTree
tests rdb = testGroup "Chainweb.Test.Rosetta" go
where
go = return $
withNodes v "rosettaRemoteTests-" rdb nodes $ \nio ->
Expand All @@ -107,42 +77,56 @@ tests rdb = testGroupSch "Chainweb.Test.Rosetta" go
, constructionMetadataTests
, constructionSubmitTests
, mempoolTransactionTests
, mempoolTests
, networkListTests
, networkOptionsTests
, networkStatusTests
]


accountBalanceTests :: RosettaTest
accountBalanceTests _tio _nio = testCaseSteps "Account Balance Lookup" $ \step -> do
ccenv <- _runClientEnv <$> _nio
return ()
where
req = AccountBalanceReq nid aid Nothing
accountBalanceTests _tio _nio = testCaseSteps "Account Balance Lookup" $ \step -> return () -- do
-- cenv <- _runClientEnv <$> _nio
-- r <- accountBalance cenv req
-- print r
-- where
-- req = AccountBalanceReq nid aid Nothing

blockTransactionTests :: RosettaTest
blockTransactionTests _tio _nio = undefined
blockTransactionTests _tio _nio =
testCaseSteps "Block Transaction Tests" $ \step -> return ()

blockTests :: RosettaTest
blockTests _tio _nio = undefined
blockTests _tio _nio =
testCaseSteps "Block Tests" $ \step -> return ()

constructionMetadataTests :: RosettaTest
constructionMetadataTests _tio _nio = undefined
constructionMetadataTests _tio _nio =
testCaseSteps "Construction Metadata Tests" $ \step -> return ()

constructionSubmitTests :: RosettaTest
constructionSubmitTests _tio _nio = undefined
constructionSubmitTests _tio _nio =
testCaseSteps "Construction Submit Tests" $ \step -> return ()

mempoolTransactionTests :: RosettaTest
mempoolTransactionTests _tio _nio = undefined
mempoolTransactionTests _tio _nio =
testCaseSteps "Mempool Transaction Tests" $ \step -> return ()

mempoolTests :: RosettaTest
mempoolTests _tio _nio =
testCaseSteps "Mempool Tests" $ \step -> return ()

networkListTests :: RosettaTest
networkListTests _tio _nio = undefined
networkListTests _tio _nio =
testCaseSteps "Network List Tests" $ \step -> return ()

networkOptionsTests :: RosettaTest
networkOptionsTests _tio _nio = undefined
networkOptionsTests _tio _nio =
testCaseSteps "Network Options Tests" $ \step -> return ()

networkStatusTests :: RosettaTest
networkStatusTests _tio _nio = undefined
networkStatusTests _tio _nio = testCaseSteps "Network Status Tests" $ \step ->
return ()

-- ------------------------------------------------------------------ --
-- Rosetta api w/ retry
Expand Down Expand Up @@ -326,3 +310,38 @@ networkStatus cenv req =
h _ = Handler $ \case
NetworkStatusFailure _ -> return True
_ -> return False

-- ------------------------------------------------------------------ --
-- Test Data

type RosettaTest = IO (Time Micros) -> IO ChainwebNetwork -> TestTree

data RosettaTestException
= AccountBalanceFailure String
| BlockTransactionFailure String
| BlockFailure String
| ConstructionMetadataFailure String
| ConstructionSubmitFailure String
| MempoolTransactionFailure String
| MempoolFailure String
| NetworkListFailure String
| NetworkOptionsFailure String
| NetworkStatusFailure String
deriving Show

instance Exception RosettaTestException


nid :: NetworkId
nid = NetworkId
{ _networkId_blockchain = "kadena"
, _networkId_network = "fastTimedCPM-peterson"
, _networkId_subNetworkId = Nothing
}

aid :: AccountId
aid = AccountId
{ _accountId_address = "sender00"
, _accountId_subAccount = Nothing
, _accountId_metadata = Nothing
}
2 changes: 2 additions & 0 deletions test/ChainwebTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import qualified Chainweb.Test.Pact.TransactionTests
import qualified Chainweb.Test.Pact.TTL
import qualified Chainweb.Test.RestAPI
import qualified Chainweb.Test.Rosetta
import qualified Chainweb.Test.Rosetta.RestAPI
import qualified Chainweb.Test.Roundtrips
import qualified Chainweb.Test.SPV
import qualified Chainweb.Test.Store.CAS.FS
Expand Down Expand Up @@ -107,6 +108,7 @@ suite rdb =
, Chainweb.Test.Store.CAS.FS.tests
, Chainweb.Test.Roundtrips.tests
, Chainweb.Test.Rosetta.tests
, Chainweb.Test.Rosetta.RestAPI.tests rdb
, Chainweb.Test.RestAPI.tests rdb
, Chainweb.Test.SPV.tests rdb
, Chainweb.Test.Pact.SPV.tests
Expand Down