Skip to content

Commit

Permalink
Merge branch 'mk/sdk-895/add-data-system' into mk/sdk-896/remove-old-…
Browse files Browse the repository at this point in the history
…configs
  • Loading branch information
keelerm84 committed Nov 14, 2024
2 parents 705ecfa + 6a82b11 commit 9f67a46
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions sdktests/common_tests_stream_fdv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (c CommonStreamingTests) StateTransitions(t *ldtest.T) {
}

func (c CommonStreamingTests) InitializeFromEmptyState(t *ldtest.T) {
streamEndpoint, _ := makeSequentialStreamHandler(t, c.makeSDKDataWithFlag("flag-key", 1, initialValue))
streamEndpoint, _ := makeSequentialStreamHandler(t, c.makeSDKDataWithFlag(1, initialValue))
t.Defer(streamEndpoint.Close)
client := NewSDKClient(t, WithStreamingConfig(baseStreamConfig(streamEndpoint)))

Expand All @@ -53,7 +53,7 @@ func (c CommonStreamingTests) InitializeFromEmptyState(t *ldtest.T) {
}

func (c CommonStreamingTests) SavesPreviouslyKnownState(t *ldtest.T) {
dataBefore := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
dataBefore := c.makeSDKDataWithFlag(1, initialValue)
dataAfter := mockld.NewServerSDKDataBuilder().IntentCode("xfer-none").IntentReason("up-to-date").Build()
streamEndpoint, _ := makeSequentialStreamHandler(t, dataBefore, dataAfter)
t.Defer(streamEndpoint.Close)
Expand All @@ -67,7 +67,7 @@ func (c CommonStreamingTests) SavesPreviouslyKnownState(t *ldtest.T) {
}

func (c CommonStreamingTests) ReplacesPreviouslyKnownState(t *ldtest.T) {
dataBefore := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
dataBefore := c.makeSDKDataWithFlag(1, initialValue)
dataAfter := mockld.NewServerSDKDataBuilder().
IntentCode("xfer-full").
IntentReason("cant-catchup").
Expand All @@ -88,7 +88,7 @@ func (c CommonStreamingTests) ReplacesPreviouslyKnownState(t *ldtest.T) {
}

func (c CommonStreamingTests) UpdatesPreviouslyKnownState(t *ldtest.T) {
dataBefore := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
dataBefore := c.makeSDKDataWithFlag(1, initialValue)
dataAfter := mockld.NewServerSDKDataBuilder().
IntentCode("xfer-changes").
IntentReason("stale").
Expand All @@ -108,7 +108,7 @@ func (c CommonStreamingTests) UpdatesPreviouslyKnownState(t *ldtest.T) {
}

func (c CommonStreamingTests) UpdatesAreNotCompleteUntilPayloadTransferredIsSent(t *ldtest.T) {
data := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
data := c.makeSDKDataWithFlag(1, initialValue)
stream := NewSDKDataSourceWithoutEndpoint(t, data)
streamEndpoint := requireContext(t).harness.NewMockEndpoint(stream.Handler(), t.DebugLogger(),
harness.MockEndpointDescription("streaming service"))
Expand Down Expand Up @@ -148,7 +148,7 @@ func (c CommonStreamingTests) UpdatesAreNotCompleteUntilPayloadTransferredIsSent
}

func (c CommonStreamingTests) IgnoresModelVersion(t *ldtest.T) {
data := c.makeSDKDataWithFlag("flag-key", 100, initialValue)
data := c.makeSDKDataWithFlag(100, initialValue)
stream := NewSDKDataSourceWithoutEndpoint(t, data)
streamEndpoint := requireContext(t).harness.NewMockEndpoint(stream.Handler(), t.DebugLogger(),
harness.MockEndpointDescription("streaming service"))
Expand All @@ -173,7 +173,7 @@ func (c CommonStreamingTests) IgnoresModelVersion(t *ldtest.T) {
}

func (c CommonStreamingTests) IgnoresHeartBeat(t *ldtest.T) {
data := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
data := c.makeSDKDataWithFlag(1, initialValue)
stream := NewSDKDataSourceWithoutEndpoint(t, data)
streamEndpoint := requireContext(t).harness.NewMockEndpoint(stream.Handler(), t.DebugLogger(),
harness.MockEndpointDescription("streaming service"))
Expand All @@ -196,7 +196,7 @@ func (c CommonStreamingTests) IgnoresHeartBeat(t *ldtest.T) {
}

func (c CommonStreamingTests) DiscardsEventsOnError(t *ldtest.T) {
data := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
data := c.makeSDKDataWithFlag(1, initialValue)
stream := NewSDKDataSourceWithoutEndpoint(t, data)
streamEndpoint := requireContext(t).harness.NewMockEndpoint(stream.Handler(), t.DebugLogger(),
harness.MockEndpointDescription("streaming service"))
Expand Down Expand Up @@ -229,7 +229,7 @@ func (c CommonStreamingTests) DiscardsEventsOnError(t *ldtest.T) {
}

func (c CommonStreamingTests) DisconnectsOnGoodbye(t *ldtest.T) {
dataBefore := c.makeSDKDataWithFlag("flag-key", 1, initialValue)
dataBefore := c.makeSDKDataWithFlag(1, initialValue)
dataAfter := mockld.NewServerSDKDataBuilder().IntentCode("xfer-none").IntentReason("up-to-date").Build()
streamEndpoint, streams := makeSequentialStreamHandler(t, dataBefore, dataAfter)
t.Defer(streamEndpoint.Close)
Expand Down
6 changes: 3 additions & 3 deletions sdktests/common_tests_stream_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"github.com/launchdarkly/go-sdk-common/v3/ldvalue"
)

func (c CommonStreamingTests) makeSDKDataWithFlag(key string, version int, value ldvalue.Value) mockld.SDKData {
func (c CommonStreamingTests) makeSDKDataWithFlag(version int, value ldvalue.Value) mockld.SDKData {
if c.isClientSide {
return mockld.NewClientSDKDataBuilder().
Flag(key, c.makeClientSideFlag(key, version, value).ClientSDKFlag).
Flag("flag-key", c.makeClientSideFlag("flag-key", version, value).ClientSDKFlag).
Build()
}
return mockld.NewServerSDKDataBuilder().Flag(c.makeServerSideFlag(key, version, value)).Build()
return mockld.NewServerSDKDataBuilder().Flag(c.makeServerSideFlag("flag-key", version, value)).Build()
}

func (c CommonStreamingTests) makeFlagData(key string, version int, value ldvalue.Value) []byte {
Expand Down
14 changes: 7 additions & 7 deletions sdktests/server_side_persistence_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
Mode: servicedef.CacheModeOff,
})

sdkData := s.makeSDKDataWithFlag("flag-key", 1, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value"))
_, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand All @@ -370,7 +370,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
Mode: servicedef.CacheModeOff,
})

sdkData := s.makeSDKDataWithFlag("flag-key", 1, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value"))
stream, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand Down Expand Up @@ -400,7 +400,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
Mode: servicedef.CacheModeOff,
})

sdkData := s.makeSDKDataWithFlag("flag-key", 1, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value"))
stream, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand Down Expand Up @@ -444,7 +444,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
Mode: servicedef.CacheModeOff,
})

sdkData := s.makeSDKDataWithFlag("flag-key", 100, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(100, ldvalue.String("value"))
stream, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand Down Expand Up @@ -515,7 +515,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
})
persistence.SetCache(cacheConfig)

sdkData := s.makeSDKDataWithFlag("flag-key", 1, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value"))
stream, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand Down Expand Up @@ -544,7 +544,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
})
persistence.SetCache(cacheConfig)

sdkData := s.makeSDKDataWithFlag("flag-key", 1, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value"))
_, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand Down Expand Up @@ -596,7 +596,7 @@ func (s *ServerSidePersistentTests) Run(t *ldtest.T) {
})
persistence.SetCache(cacheConfig)

sdkData := s.makeSDKDataWithFlag("flag-key", 1, ldvalue.String("value"))
sdkData := s.makeSDKDataWithFlag(1, ldvalue.String("value"))
_, configurers := s.setupDataSources(t, sdkData)
configurers = append(configurers, persistence)

Expand Down

0 comments on commit 9f67a46

Please sign in to comment.