Skip to content

Commit

Permalink
node: fix disabled node tests (algorand#4824)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Warehime authored Nov 29, 2022
1 parent 381a835 commit 3a5e584
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data"
"github.com/algorand/go-algorand/data/account"
"github.com/algorand/go-algorand/data/basics"
Expand Down Expand Up @@ -95,7 +94,7 @@ func setupFullNodes(t *testing.T, proto protocol.ConsensusVersion, verificationP
rootDirectory := t.TempDir()
rootDirs = append(rootDirs, rootDirectory)

defaultConfig.NetAddress = "127.0.0.1:0"
defaultConfig.NetAddress = neighbors[i]
defaultConfig.SaveToDisk(rootDirectory)

// Save empty phonebook - we'll add peers after they've been assigned listening ports
Expand Down Expand Up @@ -141,6 +140,10 @@ func setupFullNodes(t *testing.T, proto protocol.ConsensusVersion, verificationP
short := root.Address()
genesis[short] = data
}
genesis[poolAddr] = basics.AccountData{
Status: basics.Online,
MicroAlgos: basics.MicroAlgos{Raw: uint64(100000)},
}

bootstrap := bookkeeping.MakeGenesisBalances(genesis, sinkAddr, poolAddr)

Expand All @@ -158,16 +161,18 @@ func setupFullNodes(t *testing.T, proto protocol.ConsensusVersion, verificationP
cfg, err := config.LoadConfigFromDisk(rootDirectory)
require.NoError(t, err)
cfg.Archival = true
_, err = data.LoadLedger(logging.Base().With("name", nodeID), ledgerFilenamePrefix, inMem, g.Proto, bootstrap, "", crypto.Digest{}, nil, cfg)
_, err = data.LoadLedger(logging.Base().With("name", nodeID), ledgerFilenamePrefix, inMem, g.Proto, bootstrap, g.ID(), g.Hash(), nil, cfg)
require.NoError(t, err)
}

for i := range nodes {
var nodeNeighbors []string
nodeNeighbors = append(nodeNeighbors, neighbors[:i]...)
nodeNeighbors = append(nodeNeighbors, neighbors[i+1:]...)
rootDirectory := rootDirs[i]
cfg, err := config.LoadConfigFromDisk(rootDirectory)
require.NoError(t, err)

node, err := MakeFull(logging.Base().With("source", t.Name()+strconv.Itoa(i)), rootDirectory, cfg, []string{}, g)
node, err := MakeFull(logging.Base().With("source", t.Name()+strconv.Itoa(i)), rootDirectory, cfg, nodeNeighbors, g)
nodes[i] = node
require.NoError(t, err)
}
Expand All @@ -178,7 +183,9 @@ func setupFullNodes(t *testing.T, proto protocol.ConsensusVersion, verificationP
func TestSyncingFullNode(t *testing.T) {
partitiontest.PartitionTest(t)

t.Skip("This is failing randomly again - PLEASE FIX!")
if testing.Short() {
t.Skip("Test takes ~80 seconds.")
}

backlogPool := execpool.MakeBacklog(nil, 0, execpool.LowPriority, nil)
defer backlogPool.Shutdown()
Expand Down Expand Up @@ -236,7 +243,9 @@ func TestSyncingFullNode(t *testing.T) {
func TestInitialSync(t *testing.T) {
partitiontest.PartitionTest(t)

t.Skip("flaky TestInitialSync ")
if testing.Short() {
t.Skip("Test takes ~25 seconds.")
}

backlogPool := execpool.MakeBacklog(nil, 0, execpool.LowPriority, nil)
defer backlogPool.Shutdown()
Expand Down Expand Up @@ -269,8 +278,9 @@ func TestInitialSync(t *testing.T) {

func TestSimpleUpgrade(t *testing.T) {
partitiontest.PartitionTest(t)

t.Skip("Randomly failing: node_test.go:~330 : no block notification for account. Re-enable after agreement bug-fix pass")
if testing.Short() {
t.Skip("This test takes ~80 seconds.")
}

backlogPool := execpool.MakeBacklog(nil, 0, execpool.LowPriority, nil)
defer backlogPool.Shutdown()
Expand All @@ -286,6 +296,7 @@ func TestSimpleUpgrade(t *testing.T) {
configurableConsensus := make(config.ConsensusProtocols)

testParams0 := config.Consensus[protocol.ConsensusCurrentVersion]
testParams0.MinUpgradeWaitRounds = 0
testParams0.SupportGenesisHash = false
testParams0.UpgradeVoteRounds = 2
testParams0.UpgradeThreshold = 1
Expand All @@ -299,6 +310,7 @@ func TestSimpleUpgrade(t *testing.T) {
configurableConsensus[consensusTest0] = testParams0

testParams1 := config.Consensus[protocol.ConsensusCurrentVersion]
testParams1.MinUpgradeWaitRounds = 0
testParams1.SupportGenesisHash = false
testParams1.UpgradeVoteRounds = 10
testParams1.UpgradeThreshold = 8
Expand Down Expand Up @@ -389,13 +401,7 @@ func startAndConnectNodes(nodes []*AlgorandFullNode, delayStartFirstNode bool) {
}

func connectPeers(nodes []*AlgorandFullNode) {
neighbors := make([]string, 0)
for _, node := range nodes {
neighbors = append(neighbors, node.config.NetAddress)
}

for _, node := range nodes {
// node.ExtendPeerList(neighbors...)
node.net.RequestConnectOutgoing(false, nil)
}
}
Expand All @@ -410,11 +416,10 @@ func delayStartNode(node *AlgorandFullNode, peers []*AlgorandFullNode, delay tim
}()
wg.Wait()

// node0Addr := node.config.NetAddress
for _, peer := range peers {
// peer.ExtendPeerList(node0Addr)
peer.net.RequestConnectOutgoing(false, nil)
}
node.net.RequestConnectOutgoing(false, nil)
}

func TestStatusReport_TimeSinceLastRound(t *testing.T) {
Expand Down

0 comments on commit 3a5e584

Please sign in to comment.