From dbb09afb272a4428d9f6c04028b54dd1893dfab5 Mon Sep 17 00:00:00 2001 From: Jaganathan P <156800415+jagan2221@users.noreply.github.com> Date: Mon, 2 Dec 2024 09:51:38 +0530 Subject: [PATCH] Update provider_test.go --- .../globprovider/provider_test.go | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) 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())) +}