Skip to content

Commit

Permalink
Initial CircleCI implementation with test partitioning (algorand#2444)
Browse files Browse the repository at this point in the history
  • Loading branch information
bricerisingalgorand authored Jul 22, 2021
1 parent 9bcee44 commit 58fd804
Show file tree
Hide file tree
Showing 203 changed files with 3,083 additions and 25 deletions.
688 changes: 685 additions & 3 deletions .circleci/config.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ before_cache:
esac
docker save -o $HOME/docker_cache/images.tar $(docker images -a -q)
after_success:
- scripts/travis/upload_coverage.sh || true
#after_success:
# - scripts/travis/upload_coverage.sh || true

addons:
apt:
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ BUILDBRANCH := $(shell ./scripts/compute_branch.sh)
CHANNEL ?= $(shell ./scripts/compute_branch_channel.sh $(BUILDBRANCH))
DEFAULTNETWORK ?= $(shell ./scripts/compute_branch_network.sh $(BUILDBRANCH))
DEFAULT_DEADLOCK ?= $(shell ./scripts/compute_branch_deadlock_default.sh $(BUILDBRANCH))
export GOCACHE=$(SRCPATH)/tmp/go-cache

GOTAGSLIST := sqlite_unlock_notify sqlite_omit_load_extension

Expand Down Expand Up @@ -203,9 +204,9 @@ build: buildsrc
# to cache binaries from time to time on empty NFS
# dirs
buildsrc: check-go-version crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a node_exporter NONGO_BIN
mkdir -p tmp/go-cache && \
touch tmp/go-cache/file.txt && \
GOCACHE=$(SRCPATH)/tmp/go-cache go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...
mkdir -p "${GOCACHE}" && \
touch "${GOCACHE}"/file.txt && \
go install $(GOTRIMPATH) $(GOTAGS) $(GOBUILDMODE) -ldflags="$(GOLDFLAGS)" ./...

check-go-version:
./scripts/check_golang_version.sh build
Expand Down
13 changes: 13 additions & 0 deletions agreement/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ import (
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

// Test Bundle Creation
func TestBundleCreation(t *testing.T) {
partitiontest.PartitionTest(t)

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -68,6 +71,8 @@ func TestBundleCreation(t *testing.T) {

// Test Bundle validation with Zero Votes
func TestBundleCreationWithZeroVotes(t *testing.T) {
partitiontest.PartitionTest(t)

//ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
ledger, _, _, _ := readOnlyFixture100()

Expand Down Expand Up @@ -105,6 +110,8 @@ func makeBundlePanicWrapper(t *testing.T, message string, proposal proposalValue

//Test Bundle Creation with Validation for duplicate votes from same sender
func TestBundleCreationWithVotesFromSameAddress(t *testing.T) {
partitiontest.PartitionTest(t)

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture10()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -168,6 +175,8 @@ func TestBundleCreationWithVotesFromSameAddress(t *testing.T) {

//Test Bundle Creation with Validation
func TestBundleCreationWithEquivocationVotes(t *testing.T) {
partitiontest.PartitionTest(t)

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture10()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -276,6 +285,8 @@ func TestBundleCreationWithEquivocationVotes(t *testing.T) {

//Test Bundle Creation with Validation
func TestBundleCertificationWithEquivocationVotes(t *testing.T) {
partitiontest.PartitionTest(t)

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture10()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -349,6 +360,8 @@ func certificatePanicWrapper(t *testing.T, message string, ub unauthenticatedBun

// Test Bundle Creation with Equivocation Votes under Quorum
func TestBundleCreationWithEquivocationVotesUnderQuorum(t *testing.T) {
partitiontest.PartitionTest(t)

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down
21 changes: 21 additions & 0 deletions agreement/certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

func makeCertTesting(digest crypto.Digest, votes []vote, equiVotes []equivocationVote) Certificate {
Expand All @@ -42,6 +43,8 @@ func verifyBundleAgainstLedger(b unauthenticatedBundle, l Ledger, avv *AsyncVote
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand All @@ -68,6 +71,8 @@ func TestCertificateGoodCertificateBasic(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand All @@ -94,6 +99,8 @@ func TestCertificateGoodCertificateEarlyBreak(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand All @@ -120,6 +127,8 @@ func TestCertificateFinalCert(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -173,6 +182,8 @@ func TestCertificateBadCertificateWithFakeDoubleVote(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -202,6 +213,8 @@ func TestCertificateDifferentBlock(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand All @@ -224,6 +237,8 @@ func TestCertificateNoCertStep(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -256,6 +271,8 @@ func TestCertificateNotEnoughVotesToCert(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -285,6 +302,8 @@ func TestCertificateCertWrongRound(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down Expand Up @@ -313,6 +332,8 @@ func TestCertificateCertWithTooFewVotes(t *testing.T) {
}

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

ledger, addresses, vrfSecrets, otSecrets := readOnlyFixture100()
round := ledger.NextRound()
period := period(0)
Expand Down
21 changes: 21 additions & 0 deletions agreement/cryptoRequestContext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

func forEachTagDo(fn func(protocol.Tag)) {
Expand All @@ -32,6 +33,8 @@ func forEachTagDo(fn func(protocol.Tag)) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand Down Expand Up @@ -65,6 +68,8 @@ func TestCryptoRequestContextAddCancelRound(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand Down Expand Up @@ -99,6 +104,8 @@ func TestCryptoRequestContextAddCancelPeriod(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand All @@ -123,6 +130,8 @@ func TestCryptoRequestContextAddCancelProposal(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
proposal := cryptoProposalRequest{message: message{Tag: protocol.ProposalPayloadTag}, Round: rnd, Pinned: true}
Expand All @@ -146,6 +155,8 @@ func TestCryptoRequestContextAddCancelPinnedProposal(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand All @@ -169,6 +180,8 @@ func TestCryptoRequestContextAddNoCancelPinnedProposal(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand All @@ -192,6 +205,8 @@ func TestCryptoRequestContextAddNoInterferencePinnedProposal(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand Down Expand Up @@ -239,6 +254,8 @@ func TestCryptoRequestContextCleanupByRound(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)

Expand Down Expand Up @@ -300,6 +317,8 @@ func TestCryptoRequestContextCleanupByRoundPinnedCertify(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)
per := period(10)
Expand Down Expand Up @@ -361,6 +380,8 @@ func TestCryptoRequestContextCleanupByPeriod(t *testing.T) {
}

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

pending := makePendingRequestsContext()
rnd := round(10)

Expand Down
3 changes: 3 additions & 0 deletions agreement/cryptoVerifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

var _ = fmt.Printf
Expand Down Expand Up @@ -136,6 +137,8 @@ func getSelectorCapacity(tag protocol.Tag) int {
}

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

t.Skip("Test is flaky")

t.Parallel()
Expand Down
3 changes: 3 additions & 0 deletions agreement/demux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
"github.com/algorand/go-algorand/util/timers"
)

Expand Down Expand Up @@ -414,6 +415,8 @@ var demuxTestUsecases = []demuxTestUsecase{
}

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

dt := &demuxTester{T: t}
dt.Test()
}
Expand Down
3 changes: 3 additions & 0 deletions agreement/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ import (
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

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

var v vote
require.Equal(t, 1, len(protocol.Encode(&v)))

Expand Down
10 changes: 7 additions & 3 deletions agreement/fuzzer/tests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-deadlock"
//"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)

func TestMain(m *testing.M) {
Expand Down Expand Up @@ -114,6 +115,7 @@ func TestCircularNetworkTopology(t *testing.T) {
nodeCount := nodeCounts[i]
t.Run(fmt.Sprintf("TestCircularNetworkTopology-%d", nodeCount),
func(t *testing.T) {
partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
nodes := nodeCount
topologyConfig := TopologyFilterConfig{
NodesConnection: make(map[int][]int),
Expand Down Expand Up @@ -430,6 +432,7 @@ func TestFuzzer(t *testing.T) {
require.NoError(t, err)
for testName := range jsonFiles {
t.Run(testName, func(t *testing.T) {
partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
jsonFilename := jsonFiles[testName]
jsonBytes, err := ioutil.ReadFile(jsonFilename)
require.NoError(t, err)
Expand Down Expand Up @@ -493,6 +496,7 @@ func TestNetworkBandwidth(t *testing.T) {
nodeCount := nodeCounts[i]
t.Run(fmt.Sprintf("TestNetworkBandwidth-%d", nodeCount),
func(t *testing.T) {
partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
nodes := nodeCount
topologyConfig := TopologyFilterConfig{
NodesConnection: make(map[int][]int),
Expand Down Expand Up @@ -544,7 +548,7 @@ func TestUnstakedNetworkLinearGrowth(t *testing.T) {
if testing.Short() {
t.Skip()
}

partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
relayCount := 8
stakedNodeCount := 4
deadlock.Opts.Disable = true
Expand Down Expand Up @@ -657,7 +661,7 @@ func TestStakedNetworkQuadricGrowth(t *testing.T) {
if testing.Short() {
t.Skip()
}

partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
relayCount := 1
nodeCount := []int{4, 5, 6, 7, 8, 9, 10}
totalRelayedMessages := []int{}
Expand Down Expand Up @@ -768,7 +772,7 @@ func TestRegossipinngElimination(t *testing.T) {
if testing.Short() {
t.Skip()
}

partitiontest.PartitionTest(t) // Check if this expect test should by run, may SKIP
relayCounts := 8
nodeCount := 20
deadlock.Opts.Disable = true
Expand Down
Loading

0 comments on commit 58fd804

Please sign in to comment.