blob: 6a9ff1e5396074d617777d022f86967212dd866b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package transactions
import (
"crypto/sha1"
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
)
func TestTransactionCancellationWithEmptyTransaction(t *testing.T) {
ctx, cleanup := testhelper.Context()
defer cleanup()
tx, err := newTransaction(1, []Voter{
{Name: "voter", Votes: 1},
}, 1)
require.NoError(t, err)
hash := sha1.Sum([]byte{})
tx.cancel()
// When canceling a transaction, no more votes may happen.
err = tx.vote(ctx, "voter", hash[:])
require.Error(t, err)
require.Equal(t, err, ErrTransactionCanceled)
}
|