From 4cfa9415ecafcaf198b04e454294d0676f32adca Mon Sep 17 00:00:00 2001 From: Mauro Antonio Sanz Date: Fri, 4 Oct 2024 12:32:38 -0300 Subject: [PATCH] update commons dependecy --- go.mod | 2 +- go.sum | 2 ++ splitio/proxy/controllers/sdk.go | 15 +++++++-------- splitio/proxy/controllers/sdk_test.go | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 2137b567..4bc9f20c 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/gin-gonic/gin v1.10.0 github.com/google/uuid v1.3.0 github.com/splitio/gincache v1.0.1 - github.com/splitio/go-split-commons/v6 v6.0.2-0.20241003203711-098c0ea804b3 + github.com/splitio/go-split-commons/v6 v6.0.2-0.20241004152517-7bdd98db88c9 github.com/splitio/go-toolkit/v5 v5.4.0 github.com/stretchr/testify v1.9.0 go.etcd.io/bbolt v1.3.6 diff --git a/go.sum b/go.sum index e713f5a9..16bffb7a 100644 --- a/go.sum +++ b/go.sum @@ -97,6 +97,8 @@ github.com/splitio/go-split-commons/v6 v6.0.2-0.20241003202846-c19d3164beda h1:t github.com/splitio/go-split-commons/v6 v6.0.2-0.20241003202846-c19d3164beda/go.mod h1:TsvIh3XP7yjc7ly4vpj06AkoBND36SodPs5qfhb8rHc= github.com/splitio/go-split-commons/v6 v6.0.2-0.20241003203711-098c0ea804b3 h1:S3h7x9d11SRMW8S9OtL9EPOEcrT6dD2jLoozq6kWes4= github.com/splitio/go-split-commons/v6 v6.0.2-0.20241003203711-098c0ea804b3/go.mod h1:TsvIh3XP7yjc7ly4vpj06AkoBND36SodPs5qfhb8rHc= +github.com/splitio/go-split-commons/v6 v6.0.2-0.20241004152517-7bdd98db88c9 h1:ohS89uGBqOu7Yk0+mbYMbilHCEgAXDrPOatzKouibIA= +github.com/splitio/go-split-commons/v6 v6.0.2-0.20241004152517-7bdd98db88c9/go.mod h1:TsvIh3XP7yjc7ly4vpj06AkoBND36SodPs5qfhb8rHc= github.com/splitio/go-toolkit/v5 v5.4.0 h1:g5WFpRhQomnXCmvfsNOWV4s5AuUrWIZ+amM68G8NBKM= github.com/splitio/go-toolkit/v5 v5.4.0/go.mod h1:xYhUvV1gga9/1029Wbp5pjnR6Cy8nvBpjw99wAbsMko= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/splitio/proxy/controllers/sdk.go b/splitio/proxy/controllers/sdk.go index 96df7b5e..65bff306 100644 --- a/splitio/proxy/controllers/sdk.go +++ b/splitio/proxy/controllers/sdk.go @@ -151,18 +151,17 @@ func (c *SdkServerController) Memberships(ctx *gin.Context) { ctx.JSON(http.StatusInternalServerError, gin.H{}) } - mySegments := make([]dtos.MemItem, 0, len(segmentList)) + mySegments := make([]dtos.Segment, 0, len(segmentList)) for _, segmentName := range segmentList { - mySegments = append(mySegments, dtos.MemItem{Name: segmentName}) + mySegments = append(mySegments, dtos.Segment{Name: segmentName}) } - payoad := dtos.MembershipsDTO{ - MySegments: dtos.Member{ - Keys: mySegments, + payoad := dtos.MembershipsResponseDTO{ + MySegments: dtos.Memberships{ + Segments: mySegments, }, - LargeSegments: dtos.Member{ - Keys: []dtos.MemItem{}, - ChangeNumber: 0, + MyLargeSegments: dtos.Memberships{ + Segments: []dtos.Segment{}, }, } diff --git a/splitio/proxy/controllers/sdk_test.go b/splitio/proxy/controllers/sdk_test.go index 87aa75e2..b87f6e44 100644 --- a/splitio/proxy/controllers/sdk_test.go +++ b/splitio/proxy/controllers/sdk_test.go @@ -575,13 +575,13 @@ func TestMemberships(t *testing.T) { body, err := io.ReadAll(resp.Body) assert.Nil(t, err) - var memberships dtos.MembershipsDTO + var memberships dtos.MembershipsResponseDTO err = json.Unmarshal(body, &memberships) assert.Nil(t, err) - assert.Equal(t, dtos.MembershipsDTO{ - MySegments: dtos.Member{Keys: []dtos.MemItem{{Name: "segment1"}, {Name: "segment2"}, {Name: "segmentTest"}}}, - LargeSegments: dtos.Member{Keys: []dtos.MemItem{}}, + assert.Equal(t, dtos.MembershipsResponseDTO{ + MySegments: dtos.Memberships{Segments: []dtos.Segment{{Name: "segment1"}, {Name: "segment2"}, {Name: "segmentTest"}}}, + MyLargeSegments: dtos.Memberships{Segments: []dtos.Segment{}}, }, memberships) splitStorage.AssertExpectations(t)