Skip to content

Commit 8f0fac8

Browse files
committed
mmerged with latest
2 parents 888b3d9 + e2a4558 commit 8f0fac8

File tree

6 files changed

+59
-6
lines changed

6 files changed

+59
-6
lines changed

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
5.10.0 (Dec 20, 2024)
1+
5.10.0 (Jan 17, 2024)
2+
- Added support for the new impressions tracking toggle available on feature flags, both respecting the setting. Read more in our docs.
23
- Added support for arm64.
34
- Fixed vulnerabilities:
45
- Updated golang image to 1.23.4.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2024 Split Software, Inc.
1+
Copyright © 2025 Split Software, Inc.
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/gin-gonic/gin v1.10.0
99
github.com/google/uuid v1.3.0
1010
github.com/splitio/gincache v1.0.1
11-
github.com/splitio/go-split-commons/v6 v6.0.2
11+
github.com/splitio/go-split-commons/v6 v6.1.0
1212
github.com/splitio/go-toolkit/v5 v5.4.0
1313
github.com/stretchr/testify v1.9.0
1414
go.etcd.io/bbolt v1.3.6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA
9393
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
9494
github.com/splitio/gincache v1.0.1 h1:dLYdANY/BqH4KcUMCe/LluLyV5WtuE/LEdQWRE06IXU=
9595
github.com/splitio/gincache v1.0.1/go.mod h1:CcgJDSM9Af75kyBH0724v55URVwMBuSj5x1eCWIOECY=
96-
github.com/splitio/go-split-commons/v6 v6.0.2 h1:uvrNjyGCOHUjxVTB1pDUA+UB20WypoxpeLkgkgX5v+U=
97-
github.com/splitio/go-split-commons/v6 v6.0.2/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY=
96+
github.com/splitio/go-split-commons/v6 v6.1.0 h1:k3mwr12DF6gbEaV8XXU/tSAQlPkIEuzIgTEneYhGg2I=
97+
github.com/splitio/go-split-commons/v6 v6.1.0/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY=
9898
github.com/splitio/go-toolkit/v5 v5.4.0 h1:g5WFpRhQomnXCmvfsNOWV4s5AuUrWIZ+amM68G8NBKM=
9999
github.com/splitio/go-toolkit/v5 v5.4.0/go.mod h1:xYhUvV1gga9/1029Wbp5pjnR6Cy8nvBpjw99wAbsMko=
100100
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

splitio/proxy/controllers/sdk_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,56 @@ import (
2525
psmocks "github.com/splitio/split-synchronizer/v5/splitio/proxy/storage/mocks"
2626
)
2727

28+
func TestSplitChangesImpressionsDisabled(t *testing.T) {
29+
gin.SetMode(gin.TestMode)
30+
31+
var splitStorage psmocks.ProxySplitStorageMock
32+
splitStorage.On("ChangesSince", int64(-1), []string(nil)).
33+
Return(&dtos.SplitChangesDTO{Since: -1, Till: 1, Splits: []dtos.SplitDTO{{Name: "s1", Status: "ACTIVE", ImpressionsDisabled: true}, {Name: "s2", Status: "ACTIVE"}}}, nil).
34+
Once()
35+
36+
var splitFetcher splitFetcherMock
37+
var largeSegmentStorageMock largeSegmentStorageMock
38+
39+
resp := httptest.NewRecorder()
40+
ctx, router := gin.CreateTestContext(resp)
41+
logger := logging.NewLogger(nil)
42+
group := router.Group("/api")
43+
controller := NewSdkServerController(
44+
logger,
45+
&splitFetcher,
46+
&splitStorage,
47+
nil,
48+
flagsets.NewMatcher(false, nil),
49+
&largeSegmentStorageMock,
50+
)
51+
controller.Register(group)
52+
53+
ctx.Request, _ = http.NewRequest(http.MethodGet, "/api/splitChanges?since=-1", nil)
54+
ctx.Request.Header.Set("Authorization", "Bearer someApiKey")
55+
ctx.Request.Header.Set("SplitSDKVersion", "go-1.1.1")
56+
ctx.Request.Header.Set("SplitSDKMachineIp", "1.2.3.4")
57+
ctx.Request.Header.Set("SplitSDKMachineName", "ip-1-2-3-4")
58+
router.ServeHTTP(resp, ctx.Request)
59+
60+
assert.Equal(t, 200, resp.Code)
61+
62+
body, err := io.ReadAll(resp.Body)
63+
assert.Nil(t, err)
64+
65+
var s dtos.SplitChangesDTO
66+
err = json.Unmarshal(body, &s)
67+
assert.Nil(t, err)
68+
assert.Equal(t, 2, len(s.Splits))
69+
assert.Equal(t, int64(-1), s.Since)
70+
assert.Equal(t, int64(1), s.Till)
71+
assert.True(t, s.Splits[0].ImpressionsDisabled)
72+
assert.False(t, s.Splits[1].ImpressionsDisabled)
73+
74+
splitStorage.AssertExpectations(t)
75+
splitFetcher.AssertExpectations(t)
76+
}
77+
2878
func TestSplitChangesRecentSince(t *testing.T) {
2979
gin.SetMode(gin.TestMode)
3080

splitio/proxy/proxy_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestSplitChangesEndpoints(t *testing.T) {
3333
assert.Equal(t, 401, status)
3434

3535
splitStorage.On("ChangesSince", int64(-1), []string(nil)).
36-
Return(&dtos.SplitChangesDTO{Since: -1, Till: 1, Splits: []dtos.SplitDTO{{Name: "split1"}}}, nil).
36+
Return(&dtos.SplitChangesDTO{Since: -1, Till: 1, Splits: []dtos.SplitDTO{{Name: "split1", ImpressionsDisabled: true}}}, nil).
3737
Once()
3838

3939
// Make a proper request
@@ -55,6 +55,7 @@ func TestSplitChangesEndpoints(t *testing.T) {
5555
assert.Equal(t, int64(-1), changes.Since)
5656
assert.Equal(t, int64(1), changes.Till)
5757
assert.Equal(t, "split1", changes.Splits[0].Name)
58+
assert.True(t, changes.Splits[0].ImpressionsDisabled)
5859
assert.Equal(t, "application/json; charset=utf-8", headers.Get("Content-Type"))
5960

6061
// Lets evict the key (simulating a change in splits and re-check)
@@ -69,6 +70,7 @@ func TestSplitChangesEndpoints(t *testing.T) {
6970
assert.Equal(t, int64(-1), changes.Since)
7071
assert.Equal(t, int64(2), changes.Till)
7172
assert.Equal(t, "split2", changes.Splits[0].Name)
73+
assert.False(t, changes.Splits[0].ImpressionsDisabled)
7274
assert.Equal(t, "application/json; charset=utf-8", headers.Get("Content-Type"))
7375

7476
}

0 commit comments

Comments
 (0)