Skip to content

Commit

Permalink
Merge pull request #4626 from onflow/jordan/split-epoch-tests
Browse files Browse the repository at this point in the history
Split epoch integration tests into 2 cohorts
  • Loading branch information
gomisha authored Aug 18, 2023
2 parents a64cf0d + 7824795 commit 6be66ba
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 91 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ jobs:
- make -C integration bft-tests
- make -C integration collection-tests
- make -C integration consensus-tests
- make -C integration epochs-tests
- make -C integration epochs-cohort1-tests
- make -C integration epochs-cohort2-tests
- make -C integration execution-tests
- make -C integration ghost-tests
- make -C integration mvp-tests
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/flaky-test-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
paths:
- '.github/workflows/flaky-test-monitor.yml'
- '.github/workflows/ci.yml'

env:
BIGQUERY_DATASET: production_src_flow_test_metrics
Expand Down Expand Up @@ -134,7 +135,9 @@ jobs:
test_category: integration-collection
- target: consensus-tests
test_category: integration-consensus
- target: epochs-tests
- target: epochs-cohort1-tests
test_category: integration-epochs
- target: epochs-cohort2-tests
test_category: integration-epochs
- target: execution-tests
test_category: integration-execution
Expand Down
3 changes: 2 additions & 1 deletion bors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ status = [
"Integration Tests (make -C integration bft-tests)",
"Integration Tests (make -C integration collection-tests)",
"Integration Tests (make -C integration consensus-tests)",
"Integration Tests (make -C integration epochs-tests)",
"Integration Tests (make -C integration epochs-cohort1-tests)",
"Integration Tests (make -C integration epochs-cohort2-tests)",
"Integration Tests (make -C integration execution-tests)",
"Integration Tests (make -C integration ghost-tests)",
"Integration Tests (make -C integration mvp-tests)",
Expand Down
15 changes: 10 additions & 5 deletions integration/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ endif

# Run the integration test suite
.PHONY: integration-test
integration-test: access-tests ghost-tests mvp-tests execution-tests verification-tests upgrades-tests collection-tests epochs-tests network-tests consensus-tests
integration-test: access-tests ghost-tests mvp-tests execution-tests verification-tests upgrades-tests collection-tests epochs-cohort1-tests epochs-cohort2-tests network-tests consensus-tests

.PHONY: ci-integration-test
ci-integration-test: access-tests ghost-tests mvp-tests epochs-tests consensus-tests execution-tests verification-tests upgrades-tests network-tests collection-tests
ci-integration-test: access-tests ghost-tests mvp-tests epochs-cohort1-tests epochs-cohort2-tests consensus-tests execution-tests verification-tests upgrades-tests network-tests collection-tests

############################################################################################
# CAUTION: DO NOT MODIFY THE TARGETS BELOW! DOING SO WILL BREAK THE FLAKY TEST MONITOR
Expand All @@ -36,10 +36,15 @@ collection-tests:
consensus-tests:
go test $(if $(VERBOSE),-v,) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) -tags relic ./tests/consensus/...

.PHONY: epochs-tests
epochs-tests:
.PHONY: epochs-cohort1-tests
epochs-cohort1-tests:
# Use a higher timeout of 20m for the suite of tests which span full epochs
go test $(if $(VERBOSE),-v,) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) -tags relic -timeout 30m ./tests/epochs/...
go test $(if $(VERBOSE),-v,) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) -tags relic -timeout 20m ./tests/epochs/cohort1/...

.PHONY: epochs-cohort2-tests
epochs-cohort2-tests:
# Use a higher timeout of 20m for the suite of tests which span full epochs
go test $(if $(VERBOSE),-v,) $(RACE_FLAG) $(if $(JSON_OUTPUT),-json,) $(if $(NUM_RUNS),-count $(NUM_RUNS),) -tags relic -timeout 20m ./tests/epochs/cohort2/...

.PHONY: ghost-tests
ghost-tests:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package epochs
package cohort1

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/onflow/flow-go/integration/tests/epochs"
"github.com/onflow/flow-go/model/flow"
)

Expand All @@ -13,11 +14,11 @@ func TestEpochJoinAndLeaveAN(t *testing.T) {
}

type EpochJoinAndLeaveANSuite struct {
DynamicEpochTransitionSuite
epochs.DynamicEpochTransitionSuite
}

// TestEpochJoinAndLeaveAN should update access nodes and assert healthy network conditions
// after the epoch transition completes. See health check function for details.
func (s *EpochJoinAndLeaveANSuite) TestEpochJoinAndLeaveAN() {
s.runTestEpochJoinAndLeave(flow.RoleAccess, s.assertNetworkHealthyAfterANChange)
s.RunTestEpochJoinAndLeave(flow.RoleAccess, s.AssertNetworkHealthyAfterANChange)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package epochs
package cohort1

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/onflow/flow-go/integration/tests/epochs"
"github.com/onflow/flow-go/model/flow"
)

Expand All @@ -13,11 +14,11 @@ func TestEpochJoinAndLeaveLN(t *testing.T) {
}

type EpochJoinAndLeaveLNSuite struct {
DynamicEpochTransitionSuite
epochs.DynamicEpochTransitionSuite
}

// TestEpochJoinAndLeaveLN should update collection nodes and assert healthy network conditions
// after the epoch transition completes. See health check function for details.
func (s *EpochJoinAndLeaveLNSuite) TestEpochJoinAndLeaveLN() {
s.runTestEpochJoinAndLeave(flow.RoleCollection, s.assertNetworkHealthyAfterLNChange)
s.RunTestEpochJoinAndLeave(flow.RoleCollection, s.AssertNetworkHealthyAfterLNChange)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package epochs
package cohort1

import (
"testing"
Expand All @@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/onflow/flow-go/integration/tests/epochs"
"github.com/onflow/flow-go/model/flow"
)

Expand All @@ -17,7 +18,7 @@ func TestEpochStaticTransition(t *testing.T) {
// StaticEpochTransitionSuite is the suite used for epoch transition tests
// with a static identity table.
type StaticEpochTransitionSuite struct {
Suite
epochs.Suite
}

func (s *StaticEpochTransitionSuite) SetupTest() {
Expand All @@ -40,10 +41,10 @@ func (s *StaticEpochTransitionSuite) SetupTest() {
func (s *StaticEpochTransitionSuite) TestStaticEpochTransition() {

s.TimedLogf("waiting for EpochSetup phase of first epoch to begin")
s.AwaitEpochPhase(s.ctx, 0, flow.EpochPhaseSetup, time.Minute, 500*time.Millisecond)
s.AwaitEpochPhase(s.Ctx, 0, flow.EpochPhaseSetup, time.Minute, 500*time.Millisecond)
s.TimedLogf("successfully reached EpochSetup phase of first epoch")

snapshot, err := s.client.GetLatestProtocolSnapshot(s.ctx)
snapshot, err := s.Client.GetLatestProtocolSnapshot(s.Ctx)
require.NoError(s.T(), err)

header, err := snapshot.Head()
Expand All @@ -57,15 +58,15 @@ func (s *StaticEpochTransitionSuite) TestStaticEpochTransition() {

// wait for the first view of the second epoch
s.TimedLogf("waiting for the first view (%d) of second epoch %d", epoch1FinalView+1, epoch1Counter+1)
s.AwaitFinalizedView(s.ctx, epoch1FinalView+1, 4*time.Minute, 500*time.Millisecond)
s.AwaitFinalizedView(s.Ctx, epoch1FinalView+1, 4*time.Minute, 500*time.Millisecond)
s.TimedLogf("finalized first view (%d) of second epoch %d", epoch1FinalView+1, epoch1Counter+1)

// assert transition to second epoch happened as expected
// if counter is still 0, epoch emergency fallback was triggered and we can fail early
s.AssertInEpoch(s.ctx, epoch1Counter+1)
s.AssertInEpoch(s.Ctx, epoch1Counter+1)

// submit a smoke test transaction to verify the network can seal a transaction
s.TimedLogf("sending smoke test transaction in second epoch")
s.submitSmokeTestTransaction(s.ctx)
s.SubmitSmokeTestTransaction(s.Ctx)
s.TimedLogf("successfully submitted and observed sealing of smoke test transaction")
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package epochs
package cohort2

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/onflow/flow-go/integration/tests/epochs"
"github.com/onflow/flow-go/model/flow"
)

Expand All @@ -13,11 +14,11 @@ func TestEpochJoinAndLeaveSN(t *testing.T) {
}

type EpochJoinAndLeaveSNSuite struct {
DynamicEpochTransitionSuite
epochs.DynamicEpochTransitionSuite
}

// TestEpochJoinAndLeaveSN should update consensus nodes and assert healthy network conditions
// after the epoch transition completes. See health check function for details.
func (s *EpochJoinAndLeaveSNSuite) TestEpochJoinAndLeaveSN() {
s.runTestEpochJoinAndLeave(flow.RoleConsensus, s.assertNetworkHealthyAfterSNChange)
s.RunTestEpochJoinAndLeave(flow.RoleConsensus, s.AssertNetworkHealthyAfterSNChange)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package epochs
package cohort2

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/onflow/flow-go/integration/tests/epochs"
"github.com/onflow/flow-go/model/flow"
)

Expand All @@ -13,7 +14,7 @@ func TestEpochJoinAndLeaveVN(t *testing.T) {
}

type EpochJoinAndLeaveVNSuite struct {
DynamicEpochTransitionSuite
epochs.DynamicEpochTransitionSuite
}

func (s *EpochJoinAndLeaveVNSuite) SetupTest() {
Expand All @@ -33,5 +34,5 @@ func (s *EpochJoinAndLeaveVNSuite) SetupTest() {
// TestEpochJoinAndLeaveVN should update verification nodes and assert healthy network conditions
// after the epoch transition completes. See health check function for details.
func (s *EpochJoinAndLeaveVNSuite) TestEpochJoinAndLeaveVN() {
s.runTestEpochJoinAndLeave(flow.RoleVerification, s.assertNetworkHealthyAfterVNChange)
s.RunTestEpochJoinAndLeave(flow.RoleVerification, s.AssertNetworkHealthyAfterVNChange)
}
Loading

0 comments on commit 6be66ba

Please sign in to comment.