@@ -122,6 +122,53 @@ func apmConfigintegrationTest(name string) func(t *testing.T) {
122
122
},
123
123
agentCfgIndexModifier : func (t * testing.T , client * elasticsearch.Client ) {},
124
124
},
125
+ {
126
+ name : "agent receives empty remote config" ,
127
+ opampMessages : []inOutOpamp {
128
+ {
129
+ agentToServer : & protobufs.AgentToServer {
130
+ InstanceUid : []byte ("test" ),
131
+ AgentDescription : & protobufs.AgentDescription {
132
+ IdentifyingAttributes : []* protobufs.KeyValue {
133
+ {
134
+ Key : "service.name" ,
135
+ Value : & protobufs.AnyValue {Value : & protobufs.AnyValue_StringValue {StringValue : "test-agent-empty" }},
136
+ },
137
+ },
138
+ },
139
+ },
140
+ expectedServerToAgent : & protobufs.ServerToAgent {
141
+ InstanceUid : []byte ("test" ),
142
+ Capabilities : uint64 (protobufs .ServerCapabilities_ServerCapabilities_OffersRemoteConfig ),
143
+ RemoteConfig : & protobufs.AgentRemoteConfig {
144
+ ConfigHash : []byte ("-" ),
145
+ Config : & protobufs.AgentConfigMap {
146
+ ConfigMap : map [string ]* protobufs.AgentConfigFile {
147
+ "elastic" : {
148
+ Body : []byte (`{}` ),
149
+ ContentType : "application/json" ,
150
+ },
151
+ },
152
+ },
153
+ },
154
+ },
155
+ },
156
+ {
157
+ agentToServer : & protobufs.AgentToServer {
158
+ InstanceUid : []byte ("test" ),
159
+ RemoteConfigStatus : & protobufs.RemoteConfigStatus {
160
+ LastRemoteConfigHash : []byte ("-" ),
161
+ Status : protobufs .RemoteConfigStatuses_RemoteConfigStatuses_APPLIED ,
162
+ },
163
+ },
164
+ expectedServerToAgent : & protobufs.ServerToAgent {
165
+ InstanceUid : []byte ("test" ),
166
+ Capabilities : uint64 (protobufs .ServerCapabilities_ServerCapabilities_OffersRemoteConfig ),
167
+ },
168
+ },
169
+ },
170
+ agentCfgIndexModifier : func (t * testing.T , client * elasticsearch.Client ) {},
171
+ },
125
172
{
126
173
name : "agent without config applies remote" ,
127
174
opampMessages : []inOutOpamp {
@@ -287,6 +334,17 @@ func apmConfigintegrationTest(name string) func(t *testing.T) {
287
334
expectedServerToAgent : & protobufs.ServerToAgent {
288
335
InstanceUid : []byte ("test-3" ),
289
336
Capabilities : uint64 (protobufs .ServerCapabilities_ServerCapabilities_OffersRemoteConfig ),
337
+ RemoteConfig : & protobufs.AgentRemoteConfig {
338
+ ConfigHash : []byte ("-" ),
339
+ Config : & protobufs.AgentConfigMap {
340
+ ConfigMap : map [string ]* protobufs.AgentConfigFile {
341
+ "elastic" : {
342
+ Body : []byte (`{}` ),
343
+ ContentType : "application/json" ,
344
+ },
345
+ },
346
+ },
347
+ },
290
348
},
291
349
},
292
350
{
@@ -308,6 +366,17 @@ func apmConfigintegrationTest(name string) func(t *testing.T) {
308
366
expectedServerToAgent : & protobufs.ServerToAgent {
309
367
InstanceUid : []byte ("test-3" ),
310
368
Capabilities : uint64 (protobufs .ServerCapabilities_ServerCapabilities_OffersRemoteConfig ),
369
+ RemoteConfig : & protobufs.AgentRemoteConfig {
370
+ ConfigHash : []byte ("-" ),
371
+ Config : & protobufs.AgentConfigMap {
372
+ ConfigMap : map [string ]* protobufs.AgentConfigFile {
373
+ "elastic" : {
374
+ Body : []byte (`{}` ),
375
+ ContentType : "application/json" ,
376
+ },
377
+ },
378
+ },
379
+ },
311
380
},
312
381
},
313
382
{
0 commit comments