diff --git a/lib/workload/stateless/stacks/fmannotator/handlers.go b/lib/workload/stateless/stacks/fmannotator/handlers.go index 18ec65fc..cc12ace6 100644 --- a/lib/workload/stateless/stacks/fmannotator/handlers.go +++ b/lib/workload/stateless/stacks/fmannotator/handlers.go @@ -28,7 +28,8 @@ func PortalRunId(event workflowrunstatechange.Event, config *Config, token strin } req = req.WithMethod("PATCH").WithS3Endpoint().WithQuery(url.Values{ - "key": {fmt.Sprintf("*/%v/*", event.Detail.PortalRunId)}, + "currentState": {"false"}, + "key": {fmt.Sprintf("*/%v/*", event.Detail.PortalRunId)}, }).WithHeader("Content-Type", "application/json").WithHeader("Authorization", fmt.Sprintf("Bearer %s", token)) body, status, err := req.Do() diff --git a/lib/workload/stateless/stacks/fmannotator/handlers_test.go b/lib/workload/stateless/stacks/fmannotator/handlers_test.go index 625c2eb7..172546f8 100644 --- a/lib/workload/stateless/stacks/fmannotator/handlers_test.go +++ b/lib/workload/stateless/stacks/fmannotator/handlers_test.go @@ -2,6 +2,7 @@ package fmannotator import ( "database/sql" + "encoding/json" "fmt" _ "github.com/lib/pq" "github.com/stretchr/testify/require" @@ -26,6 +27,7 @@ func successCase(location *time.Location) TestCase { EventTime: sql.NullTime{Time: time.Date(2024, 9, 2, 0, 0, 0, 0, location), Valid: true}, Size: sql.NullInt64{Int64: 5, Valid: true}, StorageClass: sql.NullString{String: "Standard", Valid: true}, + Attributes: json.RawMessage(`{"portalRunId": "202409021221e6e6"}`), }, { EventType: "Deleted", @@ -34,6 +36,7 @@ func successCase(location *time.Location) TestCase { EventTime: sql.NullTime{Time: time.Date(2024, 9, 3, 0, 0, 0, 0, location), Valid: true}, Size: sql.NullInt64{}, StorageClass: sql.NullString{}, + Attributes: json.RawMessage(`{"portalRunId": "202409021221e6e6"}`), }, { EventType: "Created", @@ -42,6 +45,7 @@ func successCase(location *time.Location) TestCase { EventTime: sql.NullTime{Time: time.Date(2024, 9, 4, 0, 0, 0, 0, location), Valid: true}, Size: sql.NullInt64{Int64: 10, Valid: true}, StorageClass: sql.NullString{String: "Standard", Valid: true}, + Attributes: json.RawMessage(`{"portalRunId": "202409021221e6e6"}`), }, }} } @@ -55,6 +59,7 @@ func failCase(location *time.Location) TestCase { EventTime: sql.NullTime{Time: time.Date(2024, 9, 5, 0, 0, 0, 0, location), Valid: true}, Size: sql.NullInt64{Int64: 3, Valid: true}, StorageClass: sql.NullString{String: "Standard", Valid: true}, + Attributes: json.RawMessage(`{"portalRunId": "202409021221e6c6"}`), }, { EventType: "Deleted", @@ -63,6 +68,7 @@ func failCase(location *time.Location) TestCase { EventTime: sql.NullTime{Time: time.Date(2024, 9, 6, 0, 0, 0, 0, location), Valid: true}, Size: sql.NullInt64{}, StorageClass: sql.NullString{}, + Attributes: json.RawMessage(`{"portalRunId": "202409021221e6c6"}`), }, }} } diff --git a/lib/workload/stateless/stacks/fmannotator/internal/test/test.go b/lib/workload/stateless/stacks/fmannotator/internal/test/test.go index 81cca1ad..5a5929e5 100644 --- a/lib/workload/stateless/stacks/fmannotator/internal/test/test.go +++ b/lib/workload/stateless/stacks/fmannotator/internal/test/test.go @@ -22,12 +22,13 @@ import ( // S3Object Represents a mock S3Object. type S3Object struct { - EventType string `db:"event_type"` - Bucket string `db:"bucket"` - Key string `db:"key"` - EventTime sql.NullTime `db:"event_time"` - Size sql.NullInt64 `db:"size"` - StorageClass sql.NullString `db:"storage_class"` + EventType string `db:"event_type"` + Bucket string `db:"bucket"` + Key string `db:"key"` + EventTime sql.NullTime `db:"event_time"` + Size sql.NullInt64 `db:"size"` + StorageClass sql.NullString `db:"storage_class"` + Attributes json.RawMessage `db:"attributes"` } // SetupFileManager Setup the filemanager for testing.