diff --git a/pkg/configprovider/globprovider/provider_test.go b/pkg/configprovider/globprovider/provider_test.go index 966abb873f..d5211d4e13 100644 --- a/pkg/configprovider/globprovider/provider_test.go +++ b/pkg/configprovider/globprovider/provider_test.go @@ -159,3 +159,47 @@ func ValidateProviderScheme(p confmap.Provider) error { return nil } + +func TestRemotelyManagedMergeFlow(t *testing.T) { + fp := NewWithSettings(confmap.ProviderSettings{}) + fp.SetRemotelyManagedMergeFlow(true) + ret, err := fp.Retrieve(context.Background(), schemePrefix+filepath.Join("testdata", "mergefunc", "*.yaml"), nil) + require.NoError(t, err) + retMap, err := ret.AsConf() + assert.NoError(t, err) + expectedMap := confmap.NewFromStringMap(map[string]interface{}{ + "extensions": map[string]interface{}{ + "sumologic": map[string]interface{}{ + "childKey": "value", + "collector_fields": map[string]interface{}{ + "zone": "eu", + }, + }, + }, + processor: "someprocessor", + }) + assert.Equal(t, expectedMap, retMap) + assert.NoError(t, fp.Shutdown(context.Background())) +} + +func TestLocallyManagedMergeFlow(t *testing.T) { + fp := NewWithSettings(confmap.ProviderSettings{}) + ret, err := fp.Retrieve(context.Background(), schemePrefix+filepath.Join("testdata", "mergefunc", "*.yaml"), nil) + require.NoError(t, err) + retMap, err := ret.AsConf() + assert.NoError(t, err) + expectedMap := confmap.NewFromStringMap(map[string]interface{}{ + "extensions": map[string]interface{}{ + "sumologic": map[string]interface{}{ + "childKey": "value", + "collector_fields": map[string]interface{}{ + "cluster": "cluster-1" + "zone": "eu", + }, + }, + }, + processor: "someprocessor", + }) + assert.Equal(t, expectedMap, retMap) + assert.NoError(t, fp.Shutdown(context.Background())) +}