@@ -167,8 +167,8 @@ func TestOnConnectFail(t *testing.T) {
167
167
testClients (t , func (t * testing.T , client OpAMPClient ) {
168
168
var connectErr atomic.Value
169
169
settings := createNoServerSettings ()
170
- settings .Callbacks = types.CallbacksStruct {
171
- OnConnectFailedFunc : func (ctx context.Context , err error ) {
170
+ settings .Callbacks = types.Callbacks {
171
+ OnConnectFailed : func (ctx context.Context , err error ) {
172
172
connectErr .Store (err )
173
173
},
174
174
}
@@ -244,8 +244,8 @@ func TestConnectWithServer(t *testing.T) {
244
244
// Start a client.
245
245
var connected int64
246
246
settings := types.StartSettings {
247
- Callbacks : types.CallbacksStruct {
248
- OnConnectFunc : func (ctx context.Context ) {
247
+ Callbacks : types.Callbacks {
248
+ OnConnect : func (ctx context.Context ) {
249
249
atomic .StoreInt64 (& connected , 1 )
250
250
},
251
251
},
@@ -282,12 +282,12 @@ func TestConnectWithServer503(t *testing.T) {
282
282
var clientConnected int64
283
283
var connectErr atomic.Value
284
284
settings := types.StartSettings {
285
- Callbacks : types.CallbacksStruct {
286
- OnConnectFunc : func (ctx context.Context ) {
285
+ Callbacks : types.Callbacks {
286
+ OnConnect : func (ctx context.Context ) {
287
287
atomic .StoreInt64 (& clientConnected , 1 )
288
288
assert .Fail (t , "Client should not be able to connect" )
289
289
},
290
- OnConnectFailedFunc : func (ctx context.Context , err error ) {
290
+ OnConnectFailed : func (ctx context.Context , err error ) {
291
291
connectErr .Store (err )
292
292
},
293
293
},
@@ -484,11 +484,11 @@ func TestFirstStatusReport(t *testing.T) {
484
484
// Start a client.
485
485
var connected , remoteConfigReceived int64
486
486
settings := types.StartSettings {
487
- Callbacks : types.CallbacksStruct {
488
- OnConnectFunc : func (ctx context.Context ) {
487
+ Callbacks : types.Callbacks {
488
+ OnConnect : func (ctx context.Context ) {
489
489
atomic .AddInt64 (& connected , 1 )
490
490
},
491
- OnMessageFunc : func (ctx context.Context , msg * types.MessageData ) {
491
+ OnMessage : func (ctx context.Context , msg * types.MessageData ) {
492
492
// Verify that the client received exactly the remote config that
493
493
// the Server sent.
494
494
assert .True (t , proto .Equal (remoteConfig , msg .RemoteConfig ))
@@ -537,8 +537,8 @@ func TestIncludesDetailsOnReconnect(t *testing.T) {
537
537
538
538
var connected int64
539
539
settings := types.StartSettings {
540
- Callbacks : types.CallbacksStruct {
541
- OnConnectFunc : func (ctx context.Context ) {
540
+ Callbacks : types.Callbacks {
541
+ OnConnect : func (ctx context.Context ) {
542
542
atomic .AddInt64 (& connected , 1 )
543
543
},
544
544
},
@@ -589,8 +589,8 @@ func TestSetEffectiveConfig(t *testing.T) {
589
589
// Start a client.
590
590
sendConfig := createEffectiveConfig ()
591
591
settings := types.StartSettings {
592
- Callbacks : types.CallbacksStruct {
593
- GetEffectiveConfigFunc : func (ctx context.Context ) (* protobufs.EffectiveConfig , error ) {
592
+ Callbacks : types.Callbacks {
593
+ GetEffectiveConfig : func (ctx context.Context ) (* protobufs.EffectiveConfig , error ) {
594
594
return sendConfig , nil
595
595
},
596
596
},
@@ -822,8 +822,8 @@ func TestServerOfferConnectionSettings(t *testing.T) {
822
822
823
823
// Start a client.
824
824
settings := types.StartSettings {
825
- Callbacks : types.CallbacksStruct {
826
- OnMessageFunc : func (ctx context.Context , msg * types.MessageData ) {
825
+ Callbacks : types.Callbacks {
826
+ OnMessage : func (ctx context.Context , msg * types.MessageData ) {
827
827
assert .True (t , proto .Equal (metricsSettings , msg .OwnMetricsConnSettings ))
828
828
assert .True (t , proto .Equal (tracesSettings , msg .OwnTracesConnSettings ))
829
829
assert .True (t , proto .Equal (logsSettings , msg .OwnLogsConnSettings ))
@@ -834,7 +834,7 @@ func TestServerOfferConnectionSettings(t *testing.T) {
834
834
atomic .AddInt64 (& gotOtherSettings , 1 )
835
835
},
836
836
837
- OnOpampConnectionSettingsFunc : func (
837
+ OnOpampConnectionSettings : func (
838
838
ctx context.Context , settings * protobufs.OpAMPConnectionSettings ,
839
839
) error {
840
840
assert .True (t , proto .Equal (opampSettings , settings ))
@@ -891,8 +891,8 @@ func TestClientRequestConnectionSettings(t *testing.T) {
891
891
892
892
// Start a client.
893
893
settings := types.StartSettings {
894
- Callbacks : types.CallbacksStruct {
895
- OnOpampConnectionSettingsFunc : func (
894
+ Callbacks : types.Callbacks {
895
+ OnOpampConnectionSettings : func (
896
896
ctx context.Context , settings * protobufs.OpAMPConnectionSettings ,
897
897
) error {
898
898
assert .True (t , proto .Equal (opampSettings , settings ))
@@ -1073,8 +1073,8 @@ func TestReportEffectiveConfig(t *testing.T) {
1073
1073
// Start a client.
1074
1074
settings := types.StartSettings {
1075
1075
OpAMPServerURL : "ws://" + srv .Endpoint ,
1076
- Callbacks : types.CallbacksStruct {
1077
- GetEffectiveConfigFunc : func (ctx context.Context ) (* protobufs.EffectiveConfig , error ) {
1076
+ Callbacks : types.Callbacks {
1077
+ GetEffectiveConfig : func (ctx context.Context ) (* protobufs.EffectiveConfig , error ) {
1078
1078
return clientEffectiveConfig , nil
1079
1079
},
1080
1080
},
@@ -1139,8 +1139,8 @@ func verifyRemoteConfigUpdate(t *testing.T, successCase bool, expectStatus *prot
1139
1139
// Start a client.
1140
1140
settings := types.StartSettings {
1141
1141
OpAMPServerURL : "ws://" + srv .Endpoint ,
1142
- Callbacks : types.CallbacksStruct {
1143
- OnMessageFunc : func (ctx context.Context , msg * types.MessageData ) {
1142
+ Callbacks : types.Callbacks {
1143
+ OnMessage : func (ctx context.Context , msg * types.MessageData ) {
1144
1144
if msg .RemoteConfig != nil {
1145
1145
if successCase {
1146
1146
client .SetRemoteConfigStatus (
@@ -1355,8 +1355,8 @@ func verifyUpdatePackages(t *testing.T, testCase packageTestCase) {
1355
1355
// Start a client.
1356
1356
settings := types.StartSettings {
1357
1357
OpAMPServerURL : "ws://" + srv .Endpoint ,
1358
- Callbacks : types.CallbacksStruct {
1359
- OnMessageFunc : onMessageFunc ,
1358
+ Callbacks : types.Callbacks {
1359
+ OnMessage : onMessageFunc ,
1360
1360
},
1361
1361
PackagesStateProvider : localPackageState ,
1362
1362
Capabilities : protobufs .AgentCapabilities_AgentCapabilities_AcceptsPackages |
@@ -1542,8 +1542,8 @@ func TestMissingCapabilities(t *testing.T) {
1542
1542
1543
1543
// Start a client.
1544
1544
settings := types.StartSettings {
1545
- Callbacks : types.CallbacksStruct {
1546
- OnMessageFunc : func (ctx context.Context , msg * types.MessageData ) {
1545
+ Callbacks : types.Callbacks {
1546
+ OnMessage : func (ctx context.Context , msg * types.MessageData ) {
1547
1547
// These fields must not be set since we did not define the capabilities to accept them.
1548
1548
assert .Nil (t , msg .RemoteConfig )
1549
1549
assert .Nil (t , msg .OwnLogsConnSettings )
@@ -1552,7 +1552,7 @@ func TestMissingCapabilities(t *testing.T) {
1552
1552
assert .Nil (t , msg .OtherConnSettings )
1553
1553
assert .Nil (t , msg .PackagesAvailable )
1554
1554
},
1555
- OnOpampConnectionSettingsFunc : func (
1555
+ OnOpampConnectionSettings : func (
1556
1556
ctx context.Context , settings * protobufs.OpAMPConnectionSettings ,
1557
1557
) error {
1558
1558
assert .Fail (t , "should not be called since capability is not set to accept it" )
@@ -1613,7 +1613,7 @@ func TestMissingPackagesStateProvider(t *testing.T) {
1613
1613
testClients (t , func (t * testing.T , client OpAMPClient ) {
1614
1614
// Start a client.
1615
1615
settings := types.StartSettings {
1616
- Callbacks : types.CallbacksStruct {},
1616
+ Callbacks : types.Callbacks {},
1617
1617
Capabilities : protobufs .AgentCapabilities_AgentCapabilities_AcceptsPackages |
1618
1618
protobufs .AgentCapabilities_AgentCapabilities_ReportsPackageStatuses ,
1619
1619
}
@@ -1624,7 +1624,7 @@ func TestMissingPackagesStateProvider(t *testing.T) {
1624
1624
// Start a client.
1625
1625
localPackageState := internal .NewInMemPackagesStore ()
1626
1626
settings = types.StartSettings {
1627
- Callbacks : types.CallbacksStruct {},
1627
+ Callbacks : types.Callbacks {},
1628
1628
PackagesStateProvider : localPackageState ,
1629
1629
Capabilities : protobufs .AgentCapabilities_AgentCapabilities_AcceptsPackages ,
1630
1630
}
@@ -1634,7 +1634,7 @@ func TestMissingPackagesStateProvider(t *testing.T) {
1634
1634
1635
1635
// Start a client.
1636
1636
settings = types.StartSettings {
1637
- Callbacks : types.CallbacksStruct {},
1637
+ Callbacks : types.Callbacks {},
1638
1638
PackagesStateProvider : localPackageState ,
1639
1639
Capabilities : protobufs .AgentCapabilities_AgentCapabilities_ReportsPackageStatuses ,
1640
1640
}
@@ -1668,8 +1668,8 @@ func TestOfferUpdatedVersion(t *testing.T) {
1668
1668
// Start a client.
1669
1669
settings := types.StartSettings {
1670
1670
OpAMPServerURL : "ws://" + srv .Endpoint ,
1671
- Callbacks : types.CallbacksStruct {
1672
- OnMessageFunc : onMessageFunc ,
1671
+ Callbacks : types.Callbacks {
1672
+ OnMessage : onMessageFunc ,
1673
1673
},
1674
1674
PackagesStateProvider : localPackageState ,
1675
1675
Capabilities : protobufs .AgentCapabilities_AgentCapabilities_AcceptsPackages |
@@ -1747,8 +1747,8 @@ func TestReportCustomCapabilities(t *testing.T) {
1747
1747
// Start a client.
1748
1748
settings := types.StartSettings {
1749
1749
OpAMPServerURL : "ws://" + srv .Endpoint ,
1750
- Callbacks : types.CallbacksStruct {
1751
- OnMessageFunc : func (ctx context.Context , msg * types.MessageData ) {
1750
+ Callbacks : types.Callbacks {
1751
+ OnMessage : func (ctx context.Context , msg * types.MessageData ) {
1752
1752
clientRcvCustomMessage .Store (msg .CustomMessage )
1753
1753
},
1754
1754
},
@@ -1843,7 +1843,7 @@ func TestReportCustomCapabilities(t *testing.T) {
1843
1843
func TestSendCustomMessage (t * testing.T ) {
1844
1844
testClients (t , func (t * testing.T , client OpAMPClient ) {
1845
1845
settings := types.StartSettings {
1846
- Callbacks : types.CallbacksStruct {},
1846
+ Callbacks : types.Callbacks {},
1847
1847
}
1848
1848
prepareClient (t , & settings , client )
1849
1849
clientCustomCapabilities := & protobufs.CustomCapabilities {
0 commit comments