storj/satellite/satellitedb/coinpaymentstxs_test.go
Bill Thorp 65408db6e0 satellite/satellitedb: Coinpayments repeat insert bug fix
I introduced a bug with https://review.dev.storj.io/c/storj/storj/+/2216
Because the log change allowed insert to be called multiple times.
This changes the insert logic to do nothing if the PK already exists.

Change-Id: I90d192a0f6619bfbb360ea104066f00a3348f6dd
2020-07-20 20:21:35 +00:00

24 lines
713 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package satellitedb_test
import (
"testing"
"github.com/stretchr/testify/assert"
"storj.io/common/testcontext"
"storj.io/storj/satellite"
"storj.io/storj/satellite/payments/coinpayments"
"storj.io/storj/satellite/satellitedb/satellitedbtest"
)
func TestUpdateSameAppliesDoesNotExplode(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
tdb := db.StripeCoinPayments().Transactions()
assert.NoError(t, tdb.Update(ctx, nil, coinpayments.TransactionIDList{"blah", "blah"}))
assert.NoError(t, tdb.Update(ctx, nil, coinpayments.TransactionIDList{"blah", "blah"}))
})
}