Skip to content

Commit

Permalink
Remove service endpoints configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed Nov 13, 2024
1 parent 54bf7c6 commit 705ecfa
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 39 deletions.
6 changes: 1 addition & 5 deletions sdktests/common_tests_events_disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ func (c CommonEventTests) DisablingEvents(t *ldtest.T) {
t.Run(name, func(t *ldtest.T) {
dataSource := NewSDKDataSource(t, nil)
events := NewSDKEventSinkWithGzip(t, t.Capabilities().Has(servicedef.CapabilityEventGzip))
client := NewSDKClient(t, c.baseSDKConfigurationPlus(
WithServiceEndpointsConfig(servicedef.SDKConfigServiceEndpointsParams{
Events: events.Endpoint().BaseURL(),
}),
dataSource)...)
client := NewSDKClient(t, c.baseSDKConfigurationPlus(dataSource)...)

actionThatCausesEvent(t, client)
client.FlushEvents(t)
Expand Down
21 changes: 0 additions & 21 deletions sdktests/server_side_service_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"time"

"github.com/launchdarkly/sdk-test-harness/v2/framework/ldtest"
o "github.com/launchdarkly/sdk-test-harness/v2/framework/opt"
"github.com/launchdarkly/sdk-test-harness/v2/mockld"
"github.com/launchdarkly/sdk-test-harness/v2/servicedef"

Expand Down Expand Up @@ -64,24 +63,4 @@ func doServerSideServiceEndpointsTests(t *ldtest.T) {
},
)
})

t.Run("using separate service endpoints properties", func(t *ldtest.T) {
t.RequireCapability(servicedef.CapabilityServiceEndpoints)
doTest(
t,
func(dataSource *SDKDataSource) SDKConfigurer {
return WithServiceEndpointsConfig(servicedef.SDKConfigServiceEndpointsParams{
Streaming: dataSource.Endpoint().BaseURL(),
})
},
func(events *SDKEventSink) SDKConfigurer {
return WithConfig(servicedef.SDKConfigParams{
Events: o.Some(servicedef.SDKConfigEventParams{}),
ServiceEndpoints: o.Some(servicedef.SDKConfigServiceEndpointsParams{
Events: events.Endpoint().BaseURL(),
}),
})
},
)
})
}
14 changes: 2 additions & 12 deletions sdktests/testapi_sdk_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ func WithPollingConfig(pollingConfig servicedef.SDKConfigPollingParams) SDKConfi
})
}

// WithServiceEndpointsConfig is used with StartSDKClient to specify non-default service endpoints.
// This will only work if the test service has the "service-endpoints" capability.
func WithServiceEndpointsConfig(endpointsConfig servicedef.SDKConfigServiceEndpointsParams) SDKConfigurer {
return helpers.ConfigOptionFunc[servicedef.SDKConfigParams](func(configOut *servicedef.SDKConfigParams) error {
configOut.ServiceEndpoints = o.Some(endpointsConfig)
return nil
})
}

// WithStreamingConfig is used with StartSDKClient to specify a non-default streaming configuration.
func WithStreamingConfig(streamingConfig servicedef.SDKConfigStreamingParams) SDKConfigurer {
return helpers.ConfigOptionFunc[servicedef.SDKConfigParams](func(configOut *servicedef.SDKConfigParams) error {
Expand Down Expand Up @@ -204,14 +195,13 @@ func TryNewSDKClient(t *ldtest.T, configurers ...SDKConfigurer) (*SDKClient, err
}

func validateSDKConfig(config servicedef.SDKConfigParams) error {
if !config.DataSystem.IsDefined() && !config.PersistentDataStore.IsDefined() && config.ServiceEndpoints.Value().Streaming == "" {
if !config.DataSystem.IsDefined() && !config.PersistentDataStore.IsDefined() {
// Note that the default is streaming, so we don't necessarily need to set config.Streaming if there are
// no other customized options and if we used serviceEndpoints.streaming to set the stream URI
return errors.New(
"neither streaming nor polling was enabled-- did you forget to include the SDKDataSource as a parameter?")
}
if config.Events.IsDefined() && config.Events.Value().BaseURI == "" &&
(!config.ServiceEndpoints.IsDefined() || config.ServiceEndpoints.Value().Events == "") {
if config.Events.IsDefined() && config.Events.Value().BaseURI == "" {
return errors.New("events were enabled but base URI was not set--" +
" did you forget to include the SDKEventSink as a parameter?")
}
Expand Down
1 change: 0 additions & 1 deletion servicedef/sdk_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type SDKConfigParams struct {
Credential string `json:"credential"`
StartWaitTimeMS o.Maybe[ldtime.UnixMillisecondTime] `json:"startWaitTimeMs,omitempty"`
InitCanFail bool `json:"initCanFail,omitempty"`
ServiceEndpoints o.Maybe[SDKConfigServiceEndpointsParams] `json:"serviceEndpoints,omitempty"`
TLS o.Maybe[SDKConfigTLSParams] `json:"tls,omitempty"`
Events o.Maybe[SDKConfigEventParams] `json:"events,omitempty"`
BigSegments o.Maybe[SDKConfigBigSegmentsParams] `json:"bigSegments,omitempty"`
Expand Down

0 comments on commit 705ecfa

Please sign in to comment.