Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ issues:
- staticcheck
- typecheck
# Ignore missing parallel tests in existing packages
- path: (agreement|catchup|cmd|config|crypto|daemon|gen|ledger|logging|netdeploy|network|node|protocol|rpcs|shared|stateproof|test|tools|util).*_test\.go
- path: (agreement|catchup|cmd|config|crypto|daemon|data|gen|ledger|logging|netdeploy|network|node|protocol|rpcs|shared|stateproof|test|tools|util).*_test\.go
linters:
- paralleltest
# Add all linters here -- Comment this block out for testing linters
Expand Down
44 changes: 8 additions & 36 deletions data/account/participationRegistry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func registryCloseTest(t testing.TB, registry *participationDB, dbfilePrefix str
// Insert participation records and make sure they can be fetched.
func TestParticipation_InsertGet(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -199,7 +198,6 @@ func TestParticipation_InsertGet(t *testing.T) {
// Insert participation records and make sure they can be fetched.
func TestParticipation_InsertGetWithoutEmptyStateproof(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -240,7 +238,6 @@ func TestParticipation_InsertGetWithoutEmptyStateproof(t *testing.T) {
// Make sure a record can be deleted by id.
func TestParticipation_Delete(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistryImpl(t, false, true) // inMem=false, erasable=true
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -279,7 +276,6 @@ func (m testMessage) ToBeHashed() (protocol.HashID, []byte) {

func TestParticipation_DeleteExpired(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistryImpl(t, false, true) // inMem=false, erasable=true
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -325,7 +321,6 @@ func TestParticipation_DeleteExpired(t *testing.T) {

func TestParticipation_CleanupTablesAfterDeleteExpired(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistryImpl(t, false, true) // inMem=false, erasable=true
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -388,7 +383,6 @@ func TestParticipation_CleanupTablesAfterDeleteExpired(t *testing.T) {
// Make sure the register function properly sets effective first/last for all effected records.
func TestParticipation_Register(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -427,7 +421,6 @@ func TestParticipation_Register(t *testing.T) {
// Test error when registering a non-existing participation ID.
func TestParticipation_RegisterInvalidID(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -441,7 +434,6 @@ func TestParticipation_RegisterInvalidID(t *testing.T) {
// Test error attempting to register a key with an invalid range.
func TestParticipation_RegisterInvalidRange(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -460,7 +452,6 @@ func TestParticipation_RegisterInvalidRange(t *testing.T) {
// Test the recording function.
func TestParticipation_Record(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -515,7 +506,6 @@ func TestParticipation_Record(t *testing.T) {
// Test that attempting to record an invalid action generates an error.
func TestParticipation_RecordInvalidActionAndOutOfRange(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -538,7 +528,6 @@ func TestParticipation_RecordInvalidActionAndOutOfRange(t *testing.T) {

func TestParticipation_RecordNoKey(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -551,7 +540,6 @@ func TestParticipation_RecordNoKey(t *testing.T) {
// This would only happen if the DB was in an inconsistent state.
func TestParticipation_RecordMultipleUpdates(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -602,7 +590,6 @@ func TestParticipation_RecordMultipleUpdates(t *testing.T) {

func TestParticipation_MultipleInsertError(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -622,7 +609,6 @@ func TestParticipation_MultipleInsertError(t *testing.T) {
// it should be detected as quickly as possible.
func TestParticipation_RecordMultipleUpdates_DB(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, _ := getRegistry(t)

Expand Down Expand Up @@ -725,7 +711,6 @@ func TestParticipation_RecordMultipleUpdates_DB(t *testing.T) {

func TestParticipation_NoKeyToUpdate(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := assert.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -749,20 +734,19 @@ func TestParticipation_NoKeyToUpdate(t *testing.T) {
// TestParticipion_Blobs adds some secrets to the registry and makes sure the same ones are returned.
func TestParticipion_Blobs(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_writetest_root", false, true)
access, err := db.MakeAccessor("writetest_root", false, true)
if err != nil {
panic(err)
}
root, err := GenerateRoot(access)
access.Close()
a.NoError(err)

access, err = db.MakeAccessor(t.Name()+"_writetest", false, true)
access, err = db.MakeAccessor("writetest", false, true)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -793,20 +777,19 @@ func TestParticipion_Blobs(t *testing.T) {
// TestParticipion_EmptyBlobs makes sure empty blobs are set to nil
func TestParticipion_EmptyBlobs(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := assert.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_writetest_root", false, true)
access, err := db.MakeAccessor("writetest_root", false, true)
if err != nil {
panic(err)
}
root, err := GenerateRoot(access)
access.Close()
a.NoError(err)

access, err = db.MakeAccessor(t.Name()+"_writetest", false, true)
access, err = db.MakeAccessor("writetest", false, true)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -838,7 +821,6 @@ func TestParticipion_EmptyBlobs(t *testing.T) {

func TestRegisterUpdatedEvent(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -897,7 +879,6 @@ func TestFlushDeadlock(t *testing.T) {
var wg sync.WaitGroup

partitiontest.PartitionTest(t)
t.Parallel()
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

Expand Down Expand Up @@ -926,7 +907,6 @@ func TestFlushDeadlock(t *testing.T) {

func TestAddStateProofKeys(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -979,12 +959,11 @@ func TestAddStateProofKeys(t *testing.T) {

func TestGetRoundSecretsWithNilStateProofVerifier(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := assert.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_stateprooftest", false, true)
access, err := db.MakeAccessor("stateprooftest", false, true)
Copy link
Copy Markdown
Contributor

@algonautshant algonautshant Jan 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this as is won't hurt. Keeping or reverting is fine here and other places for this.

if err != nil {
panic(err)
}
Expand All @@ -1010,7 +989,6 @@ func TestGetRoundSecretsWithNilStateProofVerifier(t *testing.T) {

func TestSecretNotFound(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand All @@ -1030,12 +1008,11 @@ func TestSecretNotFound(t *testing.T) {

func TestAddingSecretTwice(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := assert.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_stateprooftest", false, true)
access, err := db.MakeAccessor("stateprooftest", false, true)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -1069,12 +1046,11 @@ func TestAddingSecretTwice(t *testing.T) {

func TestGetRoundSecretsWithoutStateProof(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := assert.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_stateprooftest", false, true)
access, err := db.MakeAccessor("stateprooftest", false, true)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -1128,7 +1104,6 @@ func (k keypairs) findPairForSpecificRound(round uint64) merklesignature.KeyRoun

func TestDeleteStateProofKeys(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)
Expand Down Expand Up @@ -1198,12 +1173,11 @@ func TestDeleteStateProofKeys(t *testing.T) {
// test that sets up an error that should come up while flushing, and ensures that flush resets the last error
func TestFlushResetsLastError(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := assert.New(t)
registry, dbfile := getRegistry(t)
defer registryCloseTest(t, registry, dbfile)

access, err := db.MakeAccessor(t.Name()+"_stateprooftest", false, true)
access, err := db.MakeAccessor("stateprooftest", false, true)
a.NoError(err)

root, err := GenerateRoot(access)
Expand Down Expand Up @@ -1237,7 +1211,6 @@ func TestFlushResetsLastError(t *testing.T) {
// Makes sure the table is not locked for reading while a different one is locked for writing.
func TestParticipationDB_Locking(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)

dbName := strings.Replace(t.Name(), "/", "_", -1)
Expand Down Expand Up @@ -1308,7 +1281,6 @@ func TestParticipationDB_Locking(t *testing.T) {

func TestParticipationDBInstallWhileReading(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)

if testing.Short() {
Expand Down
12 changes: 1 addition & 11 deletions data/account/participation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var partableColumnNames = [...]string{"parent", "vrf", "voting", "stateProof", "

func TestParticipation_NewDB(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := require.New(t)

Expand Down Expand Up @@ -116,7 +115,6 @@ func getSchemaVersions(db db.Accessor) (versions map[string]int, err error) {

func TestOverlapsInterval(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

const before = basics.Round(95)
const start = basics.Round(100)
Expand Down Expand Up @@ -191,7 +189,6 @@ func BenchmarkOldKeysDeletion(b *testing.B) {

func TestRetrieveFromDB(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)
part, rootDB, partDB, err := setupParticipationKey(t, a)
a.NoError(err)
Expand All @@ -208,7 +205,6 @@ func TestRetrieveFromDB(t *testing.T) {

func TestRetrieveFromDBAtVersion1(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := require.New(t)
ppart := setupkeyWithNoDBS(t, a)
Expand All @@ -231,7 +227,6 @@ func TestRetrieveFromDBAtVersion1(t *testing.T) {

func TestRetrieveFromDBAtVersion2(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := require.New(t)

Expand Down Expand Up @@ -261,7 +256,6 @@ func TestRetrieveFromDBAtVersion2(t *testing.T) {

func TestKeyRegCreation(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := require.New(t)

Expand Down Expand Up @@ -295,7 +289,6 @@ func assertionForRestoringFromDBAtLowVersion(a *require.Assertions, retrivedPart

func TestMigrateFromVersion1(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := require.New(t)
part := setupkeyWithNoDBS(t, a).Participation
Expand All @@ -311,7 +304,6 @@ func TestMigrateFromVersion1(t *testing.T) {

func TestMigrationFromVersion2(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := require.New(t)
part := setupkeyWithNoDBS(t, a).Participation
Expand Down Expand Up @@ -506,7 +498,6 @@ func createMerkleSignatureSchemeTestDB(a *require.Assertions) *db.Accessor {

func TestKeyregValidityOverLimit(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)

maxValidPeriod := config.Consensus[protocol.ConsensusCurrentVersion].MaxKeyregValidPeriod
Expand All @@ -525,7 +516,6 @@ func TestKeyregValidityOverLimit(t *testing.T) {

func TestFillDBWithParticipationKeys(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()
a := require.New(t)

dilution := config.Consensus[protocol.ConsensusCurrentVersion].DefaultKeyDilution
Expand All @@ -541,7 +531,7 @@ func TestFillDBWithParticipationKeys(t *testing.T) {
a.NoError(err)
}

func TestKeyregValidityPeriod(t *testing.T) { //nolint:paralleltest // Not parallel because it modifies config.Consensus
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good idea to keep the explanation here.

func TestKeyregValidityPeriod(t *testing.T) {
partitiontest.PartitionTest(t)
a := require.New(t)

Expand Down
Loading