Skip to content

Commit

Permalink
tests: resolve intermittent test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Nov 12, 2022
1 parent 9c7b74f commit a550dac
Showing 1 changed file with 16 additions and 76 deletions.
92 changes: 16 additions & 76 deletions test/functional/feature_on_chain_government_govvar_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,11 @@ def test_cfp_update_automatic_payout(self):

# Vote during first cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()
self.nodes[2].votegov(propId, self.mn2, "yes")
self.nodes[2].generate(1)
self.sync_blocks()
self.nodes[3].votegov(propId, self.mn3, "yes")
self.nodes[3].generate(1)
self.sync_mempools()
self.nodes[0].generate(1)
self.sync_blocks()

# No automatic payout before its activation via govvar
Expand All @@ -73,16 +68,11 @@ def test_cfp_update_automatic_payout(self):

# Vote during second cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()
self.nodes[2].votegov(propId, self.mn2, "yes")
self.nodes[2].generate(1)
self.sync_blocks()
self.nodes[3].votegov(propId, self.mn3, "yes")
self.nodes[3].generate(1)
self.sync_mempools()
self.nodes[0].generate(1)
self.sync_blocks()

# End proposal
Expand Down Expand Up @@ -120,6 +110,7 @@ def test_cfp_update_minimum_vote(self):
self.nodes[3].votegov(propId, self.mn3, "yes")
self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD * 2)
self.sync_blocks()

# First cycle should be approved
proposal = self.nodes[0].getgovproposal(propId)
Expand All @@ -131,15 +122,9 @@ def test_cfp_update_minimum_vote(self):

# Vote during second cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()
self.nodes[2].votegov(propId, self.mn2, "yes")
self.nodes[2].generate(1)
self.sync_blocks()

self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD)
self.sync_blocks()

Expand Down Expand Up @@ -169,19 +154,10 @@ def test_cfp_update_majority_threshold(self):

# Vote during first cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()
self.nodes[2].votegov(propId, self.mn2, "yes")
self.nodes[2].generate(1)
self.sync_blocks()
self.nodes[3].votegov(propId, self.mn3, "yes")
self.nodes[3].generate(1)
self.sync_blocks()

# Move to next cycle
self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD * 2)
self.sync_blocks()

Expand All @@ -195,18 +171,10 @@ def test_cfp_update_majority_threshold(self):

# Vote during second cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()
self.nodes[2].votegov(propId, self.mn2, "yes")
self.nodes[2].generate(1)
self.sync_blocks()
self.nodes[3].votegov(propId, self.mn3, "no")
self.nodes[3].generate(1)
self.sync_blocks()

self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD)
self.sync_blocks()

Expand Down Expand Up @@ -236,13 +204,8 @@ def test_cfp_update_fee_redistribution(self):

# Vote during first cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()

# Move to next cycle
self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD * 2)
self.sync_blocks()

Expand All @@ -260,12 +223,8 @@ def test_cfp_update_fee_redistribution(self):

# Vote during second cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()

self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD)
self.sync_blocks()

Expand Down Expand Up @@ -303,13 +262,8 @@ def test_cfp_update_cfp_fee(self):

# Vote during first cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()

# Move to next cycle
self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD * 2)
self.sync_blocks()

Expand All @@ -320,9 +274,8 @@ def test_cfp_update_cfp_fee(self):

# Vote during second cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.sync_mempools()
self.nodes[1].generate(1)
self.sync_blocks()

Expand Down Expand Up @@ -363,13 +316,8 @@ def test_cfp_update_voting_period(self):

# Vote during first cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()

# Move to next cycle
self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD * 2)
self.sync_blocks()

Expand All @@ -379,12 +327,8 @@ def test_cfp_update_voting_period(self):

# Vote during second cycle
self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()

self.sync_mempools()
self.nodes[0].generate(VOTING_PERIOD)
self.sync_blocks()

Expand Down Expand Up @@ -444,13 +388,9 @@ def test_cfp_update_voc_emergency_fee(self):
self.nodes[0].generate(1)

self.nodes[0].votegov(propId, self.mn0, "yes")
self.nodes[0].generate(1)
self.sync_blocks()
self.nodes[1].votegov(propId, self.mn1, "yes")
self.nodes[1].generate(1)
self.sync_blocks()

self.nodes[0].generate(EMERGENCY_PERIOD)
self.sync_mempools()
self.nodes[0].generate(EMERGENCY_PERIOD * 2)
self.sync_blocks()

# Check that fee set at creation is used for redistribution
Expand Down

0 comments on commit a550dac

Please sign in to comment.