Skip to content

Commit eb01fff

Browse files
committed
Fix existing test expectations
Signed-off-by: Zeynel Koca <[email protected]>
1 parent 62744ed commit eb01fff

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

state/aws/dynamodb/dynamodb_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,15 +635,15 @@ func TestSet(t *testing.T) {
635635
t.Run("Successfully set item with ttl = -1", func(t *testing.T) {
636636
mockedDB := &awsMock.DynamoDBClient{
637637
PutItemFn: func(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error) {
638-
assert.Len(t, params.Item, 4)
638+
// Negative TTL value means "no expiration", so TTL attribute is not set
639+
assert.Len(t, params.Item, 3)
639640

640641
result := DynamoDBItem{}
641642
require.NoError(t, attributevalue.UnmarshalMap(params.Item, &result))
642643

643644
assert.Equal(t, "someKey", result.Key)
644645
assert.JSONEq(t, "{\"Value\":\"someValue\"}", result.Value)
645-
assert.Greater(t, result.TestAttributeName, time.Now().Unix()-2)
646-
assert.Less(t, result.TestAttributeName, time.Now().Unix())
646+
assert.Equal(t, int64(0), result.TestAttributeName) // TestAttributeName should be 0 (default value) since no TTL was set
647647

648648
return &dynamodb.PutItemOutput{
649649
Attributes: map[string]types.AttributeValue{

0 commit comments

Comments
 (0)