Skip to content

Commit

Permalink
Update provider_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jagan2221 authored Dec 2, 2024
1 parent d674045 commit dbb09af
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions pkg/configprovider/globprovider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}

0 comments on commit dbb09af

Please sign in to comment.