Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikd committed Jun 5, 2020
1 parent 3a24573 commit d627485
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
14 changes: 8 additions & 6 deletions cardano-cli/test/cli/genesis-create/run
Expand Up @@ -51,7 +51,7 @@ if test "${check_start_time}" != "systemStart:correct," ; then
# cat "${OUTPUT_JSON}"
# echo

check_delegate_count=$(jq '.genDelegs' < "${OUTPUT_JSON}" | grep -c ':')
check_delegate_count=$(jq '.genDelegs' < "${OUTPUT_JSON}" | grep -c ': {')
if test "${check_delegate_count}" != "${gendlg_count}" ; then
echo "Bad genesis delegate count: ${check_delegate_count}"
error=1
Expand All @@ -64,7 +64,7 @@ if test "${check_supply}" != "${supply}" ; then
error=1
fi

jq '.genDelegs' < "${OUTPUT_JSON}" | grep ':' > "${TEST_DIR}/genesis-delegate.pairs"
jq '.genDelegs' < "${OUTPUT_JSON}" | grep ': {' > "${TEST_DIR}/genesis-delegate.pairs"

keyhash_count=$(sed 's/:.*//' < "${TEST_DIR}/genesis-delegate.pairs" | sort | uniq | wc -l)
if test "${keyhash_count}" != "${gendlg_count}" ; then
Expand All @@ -73,13 +73,15 @@ if test "${keyhash_count}" != "${gendlg_count}" ; then
error=1
fi

keyhash_delegate_count=$(sed 's/.*://' < "${TEST_DIR}/genesis-delegate.pairs" | sort | uniq | wc -l)
keyhash_delegate_count=$(sort "${TEST_DIR}/genesis-delegate.pairs" | uniq | wc -l)
if test "${keyhash_delegate_count}" != "${gendlg_count}" ; then
echo "Genesis delegate keyhashes are not unique."
echo "Genesis delegate keyhashes are not unique (${keyhash_delegate_count} != ${gendlg_count})."
cat "${TEST_DIR}/genesis-delegate.pairs"
error=1
fi

# tree "${TEST_DIR}/"

for i in $(seq 1 $gendlg_count) ; do
# Check genesis keys:
assert_file_exists "${TEST_DIR}/genesis-keys/genesis${i}.skey"
Expand All @@ -91,11 +93,11 @@ for i in $(seq 1 $gendlg_count) ; do
# Check delegate keys:
assert_file_exists "${TEST_DIR}/delegate-keys/delegate${i}.skey"
assert_file_exists "${TEST_DIR}/delegate-keys/delegate${i}.vkey"
assert_file_exists "${TEST_DIR}/delegate-keys/delegate-opcert${i}.counter"
assert_file_exists "${TEST_DIR}/delegate-keys/delegate${i}.counter"

assert_string 'Node operator signing key' "${TEST_DIR}/delegate-keys/delegate${i}.skey"
assert_string 'Node operator verification key' "${TEST_DIR}/delegate-keys/delegate${i}.vkey"
assert_string 'Node operational certificate issue counter' "${TEST_DIR}/delegate-keys/delegate-opcert${i}.counter"
assert_string 'Node operational certificate issue counter' "${TEST_DIR}/delegate-keys/delegate${i}.counter"

# Check utxo keys:
assert_file_exists "${TEST_DIR}/utxo-keys/utxo${i}.skey"
Expand Down
2 changes: 1 addition & 1 deletion cardano-config/test/Golden/ShelleyGenesis
@@ -1 +1 @@
{"activeSlotsCoeff":6.259,"protocolParams":{"poolDecayRate":0,"poolDeposit":0,"protocolVersion":{"minor":0,"major":0},"minUTxOValue":0,"decentralisationParam":1.9e-2,"maxTxSize":2048,"minFeeA":0,"maxBlockBodySize":239857,"keyMinRefund":0,"minFeeB":0,"eMax":0,"extraEntropy":{"tag":"NeutralNonce"},"maxBlockHeaderSize":217569,"keyDeposit":0,"keyDecayRate":0,"nOpt":100,"rho":0,"poolMinRefund":0,"tau":0,"a0":0},"protocolMagicId":838299499,"genDelegs":{"23d51e91ae5adc7ae801e9de4cd54175fb7464ec2680b25686bbb19452b4ed96":"839b047f56e50654bdb504832186dc1ee0c73c8de2daec7ae62738273be825b2"},"updateQuorum":16991,"networkId":"Testnet","maxMajorPV":25446,"initialFunds":{"001c14ee8e58fbcbd48dc7367c95a63fd1d937ba989820015db16ac7e5a2e89798e37a65ea2f9bcefb645de4312cf13d8ac12ae61cf242a9aa2973c9ee32e99ce2":12157196},"maxLovelaceSupply":71,"networkMagic":4036000900,"epochLength":1215,"staking":null,"systemStart":"2009-02-13T23:13:09Z","slotsPerKESPeriod":8541,"slotLength":8,"maxKESEvolutions":28899,"securityParam":120842}
{"activeSlotsCoeff":6.259,"protocolParams":{"poolDecayRate":0,"poolDeposit":0,"protocolVersion":{"minor":0,"major":0},"minUTxOValue":0,"decentralisationParam":1.9e-2,"maxTxSize":2048,"minFeeA":0,"maxBlockBodySize":239857,"keyMinRefund":0,"minFeeB":0,"eMax":0,"extraEntropy":{"tag":"NeutralNonce"},"maxBlockHeaderSize":217569,"keyDeposit":0,"keyDecayRate":0,"nOpt":100,"rho":0,"poolMinRefund":0,"tau":0,"a0":0},"protocolMagicId":838299499,"genDelegs":{"23d51e91ae5adc7ae801e9de4cd54175fb7464ec2680b25686bbb19452b4ed96":{"delegate":"839b047f56e50654bdb504832186dc1ee0c73c8de2daec7ae62738273be825b2","vrf":"231391e7ec1c450a8518134cf6fad1a8e0ed7ffd66d740f8e8271347a6de7bf2"}},"updateQuorum":16991,"networkId":"Testnet","maxMajorPV":25446,"initialFunds":{"001c14ee8e58fbcbd48dc7367c95a63fd1d937ba989820015db16ac7e5a2e89798e37a65ea2f9bcefb645de4312cf13d8ac12ae61cf242a9aa2973c9ee32e99ce2":12157196},"maxLovelaceSupply":71,"networkMagic":4036000900,"epochLength":1215,"staking":null,"systemStart":"2009-02-13T23:13:09Z","slotsPerKESPeriod":8541,"slotLength":8,"maxKESEvolutions":28899,"securityParam":120842}
7 changes: 6 additions & 1 deletion cardano-config/test/Test/Cardano/Config/Types.hs
Expand Up @@ -8,6 +8,8 @@ import Cardano.Prelude

import Data.Aeson (encode, fromJSON, decode, toJSON)

import qualified Data.ByteString.Lazy.Char8 as LBS

import Cardano.Config.Shelley.KES (decodeKESVerificationKey, encodeKESVerificationKey)
import Cardano.Config.Shelley.VRF (decodeVRFVerificationKey, encodeVRFVerificationKey)
import Shelley.Spec.Ledger.Address (serialiseAddr, deserialiseAddr)
Expand Down Expand Up @@ -79,5 +81,8 @@ prop_roundtrip_VKeyES_TPraosStandardCrypto_CBOR =
-- -----------------------------------------------------------------------------

tests :: IO Bool
tests =
tests = do
if False
then LBS.writeFile "test/Golden/ShelleyGenesis" (encode exampleShelleyGenesis)
else pure ()
Hedgehog.checkParallel $$discover

0 comments on commit d627485

Please sign in to comment.