Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/splitio/go-client/v6
go 1.18

require (
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250918192536-25a68d9aef39
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250925190328-f22ee3e27850
github.com/splitio/go-toolkit/v5 v5.4.0

)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.0.4 h1:FC82T+CHJ/Q/PdyLW++GeCO+Ol59Y4T7R4jbgjvktgc=
github.com/redis/go-redis/v9 v9.0.4/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250918192536-25a68d9aef39 h1:4ZncywIge5lCHbD3q+osxWPGGthzEbCOj6kDTVF7AoA=
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250918192536-25a68d9aef39/go.mod h1:cuW2HjbJJCVjlmmgJyoTs5UFxz8ET8vCgMUvZg1/EBg=
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250925190328-f22ee3e27850 h1:1HOSjfkE+mFSdYRmL5Cv34LzfgmHgBEdCKtr2d66wpQ=
github.com/splitio/go-split-commons/v6 v6.1.1-0.20250925190328-f22ee3e27850/go.mod h1:cuW2HjbJJCVjlmmgJyoTs5UFxz8ET8vCgMUvZg1/EBg=
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.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
Expand Down
2 changes: 1 addition & 1 deletion splitio/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ func TestBlockUntilReadyInMemoryError(t *testing.T) {
t.Error("It should return error")
}

if err != nil && err.Error() != "SDK Initialization failed" {
if err != nil && err.Error() != "SDK Initialization: time of 5 exceeded" {
t.Error("Wrong error. Got: ", err.Error())
}
}
Expand Down
10 changes: 2 additions & 8 deletions splitio/client/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,9 @@ func (f *SplitFactory) IsReady() bool {

// initializates tasks for in-memory mode
func (f *SplitFactory) initializationManager(readyChannel chan int, flagSetsInvalid int64) {
go f.syncManager.Start()
msg := <-readyChannel
switch msg {
case synchronizer.Ready:
// Broadcast ready status for SDK
go f.syncManager.StartBGSyng(readyChannel, f.cfg.Advanced.RetryEnabled, func() {
f.broadcastReadiness(sdkStatusReady, make([]string, 0), flagSetsInvalid)
default:
f.broadcastReadiness(sdkInitializationFailed, make([]string, 0), flagSetsInvalid)
}
})
}

func (f *SplitFactory) initializationRedis() {
Expand Down
43 changes: 33 additions & 10 deletions splitio/client/input_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,16 @@ func TestConsumerFactoryFlagSets(t *testing.T) {

func TestNotReadyYet(t *testing.T) {
nonReadyUsages := 0
logger := getMockedLogger()
mLocal := MockWriter{}
logger := logging.NewLogger(&logging.LoggerOptions{
LogLevel: logging.LevelInfo,
ErrorWriter: &mLocal,
WarningWriter: &mLocal,
InfoWriter: &mLocal,
DebugWriter: nil,
VerboseWriter: nil,
})
//logger := getMockedLogger()
telemetryStorage := mocks.MockTelemetryStorage{
RecordNonReadyUsageCall: func() {
nonReadyUsages++
Expand Down Expand Up @@ -703,40 +712,54 @@ func TestNotReadyYet(t *testing.T) {
expectedMessage1 := "{operation}: the SDK is not ready, results may be incorrect for feature flag feature. Make sure to wait for SDK readiness before using this method"
expectedMessage2 := "{operation}: the SDK is not ready, results may be incorrect for feature flags feature, feature_2. Make sure to wait for SDK readiness before using this method"

mLocal.Reset()
clientNotReady.Treatment("test", "feature", nil)
if !mW.Matches(strings.Replace(expectedMessage1, "{operation}", "Treatment", 1)) {
if !mLocal.Matches(strings.Replace(expectedMessage1, "{operation}", "Treatment", 1)) {
t.Error("Wrong message")
}

mLocal.Reset()
clientNotReady.Treatments("test", []string{"feature", "feature_2"}, nil)
if !mW.Matches(strings.Replace(expectedMessage2, "{operation}", "Treatments", 1)) {
if !mLocal.Matches(strings.Replace(expectedMessage2, "{operation}", "Treatments", 1)) {
t.Error("Wrong message")
}

mLocal.Reset()
clientNotReady.TreatmentWithConfig("test", "feature", nil)
if !mW.Matches(strings.Replace(expectedMessage1, "{operation}", "TreatmentWithConfig", 1)) {
if !mLocal.Matches(strings.Replace(expectedMessage1, "{operation}", "TreatmentWithConfig", 1)) {
t.Error("Wrong message")
}

mLocal.Reset()
clientNotReady.TreatmentsWithConfig("test", []string{"feature", "feature_2"}, nil)
if !mW.Matches(strings.Replace(expectedMessage2, "{operation}", "TreatmentsWithConfig", 1)) {
t.Error("Wrong message", mW.messages)
if !mLocal.Matches(strings.Replace(expectedMessage2, "{operation}", "TreatmentsWithConfig", 1)) {
t.Error("Wrong message", mLocal.messages)
}

mLocal.Reset()
expected := "Track: the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method"
expectedTrack(clientNotReady.Track("key", "traffic", "eventType", nil, nil), expected, t)

clientNotReady.Track("key", "traffic", "eventType", nil, nil)
if !mLocal.Matches(expected) {
t.Error("Wrong message")
}
//expectedTrack(clientNotReady.Track("key", "traffic", "eventType", nil, nil), expected, t)

mLocal.Reset()
maganerNotReady.Split("feature")
if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "Split", 1)) {
if !mLocal.Matches(strings.Replace(expectedMessage, "{operation}", "Split", 1)) {
t.Error("Wrong message")
}

mLocal.Reset()
maganerNotReady.Splits()
if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "Splits", 1)) {
if !mLocal.Matches(strings.Replace(expectedMessage, "{operation}", "Splits", 1)) {
t.Error("Wrong message")
}

mLocal.Reset()
maganerNotReady.SplitNames()
if !mW.Matches(strings.Replace(expectedMessage, "{operation}", "SplitNames", 1)) {
if !mLocal.Matches(strings.Replace(expectedMessage, "{operation}", "SplitNames", 1)) {
t.Error("Wrong message")
}

Expand Down
2 changes: 2 additions & 0 deletions splitio/conf/sdkconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type AdvancedConfig struct {
FlagSetsFilter []string
FeatureFlagRules []string
RuleBasedSegmentRules []string
RetryEnabled bool
}

// Default returns a config struct with all the default values
Expand Down Expand Up @@ -172,6 +173,7 @@ func Default() *SplitSdkConfig {
StreamingEnabled: true,
FeatureFlagRules: featureFlagsRules,
RuleBasedSegmentRules: ruleBasedSegmentRules,
RetryEnabled: true,
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion splitio/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package splitio

// Version contains a string with the split sdk version
const Version = "6.7.0"
const Version = "6.7.1-rc"