blob: 38828396ad30d0e5beb7220ade35986fb2276e1e (
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
|
package transactions
import (
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/voting"
)
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)
tx.cancel()
// When canceling a transaction, no more votes may happen.
err = tx.vote(ctx, "voter", voting.VoteFromData([]byte{}))
require.Error(t, err)
require.Equal(t, err, ErrTransactionCanceled)
}
|