Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
change test policy
Browse files Browse the repository at this point in the history
  • Loading branch information
dnkolegov committed May 31, 2022
1 parent 906a8c9 commit 4698b5e
Showing 1 changed file with 2 additions and 83 deletions.
85 changes: 2 additions & 83 deletions itests/eudico_subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestEudicoSubnetSmoke(t *testing.T) {
}

func TestEudicoSubnetTwoNodesBasic(t *testing.T) {
t.Run("/root/pow-/subnet/mir", func(t *testing.T) {
t.Run("/root/mir-/subnet/mir", func(t *testing.T) {
runSubnetTestsTwoNodes(t, kit.ThroughRPC(), kit.RootMir(), kit.SubnetMir())
})
}
Expand All @@ -44,21 +44,13 @@ func TestEudicoSubnetTwoNodesCrossMessage(t *testing.T) {
}

func TestEudicoSubnetMir(t *testing.T) {
t.Run("/root/mir-/subnet/dummy", func(t *testing.T) {
runSubnetTests(t, kit.ThroughRPC(), kit.RootMir(), kit.SubnetDummy())
})

t.Run("/root/dummy-/subnet/mir", func(t *testing.T) {
runSubnetTests(t, kit.ThroughRPC(), kit.RootDummy(), kit.SubnetMir(), kit.MinValidators(1), kit.ValidatorAddress("127.0.0.1:11001"))
})

t.Run("/root/mir-/subnet/delegated", func(t *testing.T) {
runSubnetTests(t, kit.ThroughRPC(), kit.RootMir(), kit.SubnetDelegated())
})

t.Run("/root/delegated-/subnet/mir", func(t *testing.T) {
runSubnetTests(t, kit.ThroughRPC(), kit.RootDelegated(), kit.SubnetMir(), kit.MinValidators(1), kit.ValidatorAddress("127.0.0.1:11002"))
})
}

func TestEudicoSubnetOneNodeBasic(t *testing.T) {
Expand Down Expand Up @@ -156,7 +148,6 @@ func (ts *eudicoSubnetSuite) testBasicSubnetFlow(t *testing.T) {

n, valAddr := ens.ValidatorInfo()

startTime := time.Now()
addr, err := full.WalletDefaultAddress(ctx)
require.NoError(t, err)
t.Logf("[*] wallet addr: %s", addr)
Expand Down Expand Up @@ -196,7 +187,7 @@ func (ts *eudicoSubnetSuite) testBasicSubnetFlow(t *testing.T) {
minerStake := abi.NewStoragePower(1e8)
checkPeriod := abi.ChainEpoch(10)

err = kit.WaitForBalance(ctx, addr, 20, full)
err = kit.WaitForBalance(ctx, addr, 12, full)
require.NoError(t, err)

balance, err := full.WalletBalance(ctx, addr)
Expand Down Expand Up @@ -339,20 +330,6 @@ func (ts *eudicoSubnetSuite) testBasicSubnetFlow(t *testing.T) {
err = full.MineSubnet(ctx, addr, subnetAddr, true, &mp)
require.NoError(t, err)

newHeads, err := full.SubnetChainNotify(ctx, subnetAddr)
require.NoError(t, err)

notStopped := true
for notStopped {
select {
case b := <-newHeads:
t.Logf("[*] stopping mining: mined a block: %d", b[0].Val.Height())
default:
t.Log("[*] miner stopped eventually")
notStopped = false
}
}

// Leaving the subnet.

t.Log("[*] leaving subnet")
Expand All @@ -363,8 +340,6 @@ func (ts *eudicoSubnetSuite) testBasicSubnetFlow(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(sn))
require.NotEqual(t, 0, sn[0].Subnet.Status)

t.Logf("[*] test time: %v\n", time.Since(startTime).Seconds())
}

func runSubnetTestsTwoNodes(t *testing.T, opts ...interface{}) {
Expand Down Expand Up @@ -652,34 +627,6 @@ func (ts *eudicoSubnetSuite) testBasicSubnetFlowTwoNodes(t *testing.T) {
t.Log("[*] miner B in subnet stopping")
err = nodeB.MineSubnet(ctx, minerB, subnetAddr, true, &mp)
require.NoError(t, err)

newHeads, err := nodeA.SubnetChainNotify(ctx, subnetAddr)
require.NoError(t, err)

notStopped := true
for notStopped {
select {
case b := <-newHeads:
t.Logf("[*] node A: stopping mining: mined a block: %d", b[0].Val.Height())
default:
t.Log("[*] node A: stopped miner eventually")
notStopped = false
}
}

newHeads, err = nodeB.SubnetChainNotify(ctx, subnetAddr)
require.NoError(t, err)

notStopped = true
for notStopped {
select {
case b := <-newHeads:
t.Logf("[*] node B: stopping mining: mined a block: %d", b[0].Val.Height())
default:
t.Log("[*] node B: stopped miner eventually")
notStopped = false
}
}
}

func runSubnetTwoNodesCrossMessage(t *testing.T, opts ...interface{}) {
Expand Down Expand Up @@ -962,32 +909,4 @@ func (ts *eudicoSubnetSuite) testSubnetTwoNodesCrossMessage(t *testing.T) {
t.Log("[*] miner B in subnet stopping")
err = nodeB.MineSubnet(ctx, minerB, subnetBAddr, true, &mp)
require.NoError(t, err)

newHeads, err := nodeA.SubnetChainNotify(ctx, subnetAAddr)
require.NoError(t, err)

notStopped := true
for notStopped {
select {
case b := <-newHeads:
t.Logf("[*] node A: stopping mining: mined a block: %d", b[0].Val.Height())
default:
t.Log("[*] node A: stopped miner eventually")
notStopped = false
}
}

newHeads, err = nodeB.SubnetChainNotify(ctx, subnetBAddr)
require.NoError(t, err)

notStopped = true
for notStopped {
select {
case b := <-newHeads:
t.Logf("[*] node B: stopping mining: mined a block: %d", b[0].Val.Height())
default:
t.Log("[*] node B: stopped miner eventually")
notStopped = false
}
}
}

0 comments on commit 4698b5e

Please sign in to comment.