Skip to content

Commit e59cfe2

Browse files
committed
fix: Dynamodb certification tests are failing
Probably stale data Signed-off-by: Javier Aliaga <[email protected]>
1 parent 27a8928 commit e59cfe2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

state/aws/dynamodb/dynamodb.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ func (d *StateStore) Multi(ctx context.Context, request *state.TransactionalStat
477477
return fmt.Errorf("dynamodb error: failed to marshal value for key %s: %w", req.Key, err)
478478
}
479479
twi.Put = pd.ToPut()
480-
480+
twi.ConditionCheck.ReturnValuesOnConditionCheckFailure = types.ReturnValuesOnConditionCheckFailureAllOld
481481
case state.DeleteRequest:
482482
twi.Delete = &types.Delete{
483483
TableName: ptr.Of(d.table),
@@ -490,6 +490,7 @@ func (d *StateStore) Multi(ctx context.Context, request *state.TransactionalStat
490490
}
491491
twinput.TransactItems = append(twinput.TransactItems, twi)
492492
}
493+
493494
_, err := d.dynamodbClient.TransactWriteItems(ctx, twinput)
494495

495496
return err

tests/certification/state/aws/dynamodb/dynamodb_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@ import (
1919
"testing"
2020
"time"
2121

22-
dynamodb "github.com/dapr/components-contrib/state/aws/dynamodb"
22+
"github.com/dapr/components-contrib/state/aws/dynamodb"
2323
"github.com/dapr/components-contrib/tests/certification/embedded"
2424
"github.com/dapr/components-contrib/tests/certification/flow"
2525
"github.com/dapr/go-sdk/client"
2626

27+
"github.com/stretchr/testify/assert"
28+
"github.com/stretchr/testify/require"
29+
2730
secretstore_env "github.com/dapr/components-contrib/secretstores/local/env"
2831
"github.com/dapr/components-contrib/tests/certification/flow/sidecar"
2932
secretstores_loader "github.com/dapr/dapr/pkg/components/secretstores"
3033
state_loader "github.com/dapr/dapr/pkg/components/state"
3134
dapr_testing "github.com/dapr/dapr/pkg/testing"
3235
"github.com/dapr/kit/logger"
33-
"github.com/stretchr/testify/assert"
34-
"github.com/stretchr/testify/require"
3536
)
3637

3738
const (
@@ -139,6 +140,12 @@ func TestAWSDynamoDBStorage(t *testing.T) {
139140
err = cl.SaveState(ctx, statestore, kdel, []byte(kdel), nil)
140141
require.NoError(t, err)
141142

143+
err = cl.DeleteState(ctx, statestore, ktx1, nil)
144+
require.NoError(t, err)
145+
146+
err = cl.DeleteState(ctx, statestore, ktx2, nil)
147+
require.NoError(t, err)
148+
142149
err = cl.ExecuteStateTransaction(ctx, statestore, nil, []*client.StateOperation{
143150
{
144151
Type: client.StateOperationTypeUpsert,

0 commit comments

Comments
 (0)