fixed doc env vars + mongo v2 migration
This commit is contained in:
@@ -6,16 +6,16 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tech/sendico/ledger/storage/model"
|
||||
"github.com/tech/sendico/pkg/db/repository"
|
||||
"github.com/tech/sendico/pkg/db/repository/builder"
|
||||
rd "github.com/tech/sendico/pkg/db/repository/decoder"
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -176,13 +176,13 @@ func TestOutboxStore_ListPending(t *testing.T) {
|
||||
func TestOutboxStore_MarkSent(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
logger := zap.NewNop()
|
||||
eventRef := primitive.NewObjectID()
|
||||
eventRef := bson.NewObjectID()
|
||||
sentTime := time.Now()
|
||||
|
||||
t.Run("Success", func(t *testing.T) {
|
||||
var patchedID primitive.ObjectID
|
||||
var patchedID bson.ObjectID
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
patchedID = id
|
||||
return nil
|
||||
},
|
||||
@@ -199,7 +199,7 @@ func TestOutboxStore_MarkSent(t *testing.T) {
|
||||
stub := &repositoryStub{}
|
||||
store := &outboxStore{logger: logger, repo: stub}
|
||||
|
||||
err := store.MarkSent(ctx, primitive.NilObjectID, sentTime)
|
||||
err := store.MarkSent(ctx, bson.NilObjectID, sentTime)
|
||||
|
||||
require.Error(t, err)
|
||||
assert.True(t, errors.Is(err, merrors.ErrInvalidArg))
|
||||
@@ -208,7 +208,7 @@ func TestOutboxStore_MarkSent(t *testing.T) {
|
||||
t.Run("PatchError", func(t *testing.T) {
|
||||
expectedErr := errors.New("database error")
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
return expectedErr
|
||||
},
|
||||
}
|
||||
@@ -224,12 +224,12 @@ func TestOutboxStore_MarkSent(t *testing.T) {
|
||||
func TestOutboxStore_MarkFailed(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
logger := zap.NewNop()
|
||||
eventRef := primitive.NewObjectID()
|
||||
eventRef := bson.NewObjectID()
|
||||
|
||||
t.Run("Success", func(t *testing.T) {
|
||||
var patchedID primitive.ObjectID
|
||||
var patchedID bson.ObjectID
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
patchedID = id
|
||||
return nil
|
||||
},
|
||||
@@ -246,7 +246,7 @@ func TestOutboxStore_MarkFailed(t *testing.T) {
|
||||
stub := &repositoryStub{}
|
||||
store := &outboxStore{logger: logger, repo: stub}
|
||||
|
||||
err := store.MarkFailed(ctx, primitive.NilObjectID)
|
||||
err := store.MarkFailed(ctx, bson.NilObjectID)
|
||||
|
||||
require.Error(t, err)
|
||||
assert.True(t, errors.Is(err, merrors.ErrInvalidArg))
|
||||
@@ -255,7 +255,7 @@ func TestOutboxStore_MarkFailed(t *testing.T) {
|
||||
t.Run("PatchError", func(t *testing.T) {
|
||||
expectedErr := errors.New("database error")
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
return expectedErr
|
||||
},
|
||||
}
|
||||
@@ -271,12 +271,12 @@ func TestOutboxStore_MarkFailed(t *testing.T) {
|
||||
func TestOutboxStore_IncrementAttempts(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
logger := zap.NewNop()
|
||||
eventRef := primitive.NewObjectID()
|
||||
eventRef := bson.NewObjectID()
|
||||
|
||||
t.Run("Success", func(t *testing.T) {
|
||||
var patchedID primitive.ObjectID
|
||||
var patchedID bson.ObjectID
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
patchedID = id
|
||||
return nil
|
||||
},
|
||||
@@ -293,7 +293,7 @@ func TestOutboxStore_IncrementAttempts(t *testing.T) {
|
||||
stub := &repositoryStub{}
|
||||
store := &outboxStore{logger: logger, repo: stub}
|
||||
|
||||
err := store.IncrementAttempts(ctx, primitive.NilObjectID)
|
||||
err := store.IncrementAttempts(ctx, bson.NilObjectID)
|
||||
|
||||
require.Error(t, err)
|
||||
assert.True(t, errors.Is(err, merrors.ErrInvalidArg))
|
||||
@@ -302,7 +302,7 @@ func TestOutboxStore_IncrementAttempts(t *testing.T) {
|
||||
t.Run("PatchError", func(t *testing.T) {
|
||||
expectedErr := errors.New("database error")
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
return expectedErr
|
||||
},
|
||||
}
|
||||
@@ -317,7 +317,7 @@ func TestOutboxStore_IncrementAttempts(t *testing.T) {
|
||||
t.Run("MultipleIncrements", func(t *testing.T) {
|
||||
var callCount int
|
||||
stub := &repositoryStub{
|
||||
PatchFunc: func(ctx context.Context, id primitive.ObjectID, _ repository.PatchDoc) error {
|
||||
PatchFunc: func(ctx context.Context, id bson.ObjectID, _ repository.PatchDoc) error {
|
||||
callCount++
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user