diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-08-19 16:15:31 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-08-19 16:15:31 +0300 |
commit | ec0a0f597e51e48b9b73a58ef92f95b1273a61b7 (patch) | |
tree | 25036f962e0d4cfb507d8fb73061dd582d93ba3b /internal/praefect/transaction_test.go | |
parent | 89df05730d113bd81091f91e8fae7c411cb731ca (diff) |
test: Parallel tests dependent on the PostgreSQL database
As now we create a new database on each call of the
glsql.GetDB the test execution time increased. To mitigate
that problem we make tests dependent on the PostgreSQL database
parallel. It should reduce test execution time and may help us
to find new issues in the code because of the shared global state.
Diffstat (limited to 'internal/praefect/transaction_test.go')
-rw-r--r-- | internal/praefect/transaction_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/praefect/transaction_test.go b/internal/praefect/transaction_test.go index 80da5b777..7f79c1430 100644 --- a/internal/praefect/transaction_test.go +++ b/internal/praefect/transaction_test.go @@ -70,6 +70,7 @@ func verifyCounterMetrics(t *testing.T, manager *transactions.Manager, expected } func TestTransactionSucceeds(t *testing.T) { + t.Parallel() ctx, cancel := testhelper.Context() defer cancel() @@ -110,6 +111,7 @@ func TestTransactionSucceeds(t *testing.T) { } func TestTransactionWithMultipleNodes(t *testing.T) { + t.Parallel() testcases := []struct { desc string nodes []string @@ -220,6 +222,7 @@ func TestTransactionWithMultipleNodes(t *testing.T) { } func TestTransactionWithContextCancellation(t *testing.T) { + t.Parallel() ctx, cancel := testhelper.Context() defer cancel() @@ -330,6 +333,7 @@ func TestTransactionRegistrationWithInvalidThresholdFails(t *testing.T) { } func TestTransactionReachesQuorum(t *testing.T) { + t.Parallel() tc := []struct { desc string voters []voter @@ -459,6 +463,7 @@ func TestTransactionReachesQuorum(t *testing.T) { } func TestTransactionWithMultipleVotes(t *testing.T) { + t.Parallel() type multiVoter struct { voteCount uint votes []string @@ -567,6 +572,7 @@ func TestTransactionWithMultipleVotes(t *testing.T) { } func TestTransactionFailures(t *testing.T) { + t.Parallel() ctx, cancel := testhelper.Context() defer cancel() @@ -595,6 +601,7 @@ func TestTransactionFailures(t *testing.T) { } func TestTransactionCancellation(t *testing.T) { + t.Parallel() testcases := []struct { desc string voters []voter @@ -713,6 +720,7 @@ func TestTransactionCancellation(t *testing.T) { } func TestStopTransaction(t *testing.T) { + t.Parallel() hash := sha1.Sum([]byte("foo")) t.Run("stopping nonexisting transaction fails", func(t *testing.T) { |