@@ -37,6 +37,8 @@ import (
37
37
"github.com/stretchr/testify/require"
38
38
"go.elastic.co/apm/v2/apmtest"
39
39
"go.uber.org/zap"
40
+ "go.uber.org/zap/zapcore"
41
+ "go.uber.org/zap/zaptest/observer"
40
42
41
43
"github.com/elastic/apm-server/internal/beater/config"
42
44
"github.com/elastic/apm-server/internal/elasticsearch"
@@ -243,6 +245,28 @@ func TestRunnerNewDocappenderConfig(t *testing.T) {
243
245
}
244
246
}
245
247
248
+ func TestAgentConfigFetcherDeprecation (t * testing.T ) {
249
+ core , observed := observer .New (zapcore .DebugLevel )
250
+ logger := logp .NewLogger ("bo" , zap .WrapCore (func (in zapcore.Core ) zapcore.Core {
251
+ return zapcore .NewTee (in , core )
252
+ }))
253
+
254
+ _ , _ , err := newAgentConfigFetcher (context .Background (), & config.Config {
255
+ FleetAgentConfigs : []config.FleetAgentConfig {
256
+ {
257
+ AgentName : "foo" ,
258
+ },
259
+ },
260
+ }, nil , func (c * elasticsearch.Config ) (* elasticsearch.Client , error ) { return nil , nil }, nil , logger )
261
+ require .NoError (t , err )
262
+
263
+ all := observed .All ()
264
+ assert .Len (t , all , 1 )
265
+ record := all [0 ]
266
+ assert .Equal (t , zapcore .WarnLevel , record .Level , record .Message )
267
+ assert .Equal (t , agentcfgDeprecationNotice , record .Message )
268
+ }
269
+
246
270
func TestNewInstrumentation (t * testing.T ) {
247
271
var auth string
248
272
labels := make (chan map [string ]string , 1 )
0 commit comments