Chore: Remove context.TODO() (#43409)

* Remove context.TODO() from services

* Fix live test

* Remove context.TODO
This commit is contained in:
idafurjes
2021-12-22 11:02:42 +01:00
committed by GitHub
parent 2409d8dc1f
commit b8852ef6a3
45 changed files with 133 additions and 126 deletions
@@ -21,27 +21,27 @@ const (
func TestConfigReader(t *testing.T) {
t.Run("Broken yaml should return error", func(t *testing.T) {
reader := newConfigReader(log.New("test logger"), nil)
_, err := reader.readConfig(brokenYaml)
_, err := reader.readConfig(context.Background(), brokenYaml)
require.Error(t, err)
})
t.Run("Skip invalid directory", func(t *testing.T) {
cfgProvider := newConfigReader(log.New("test logger"), nil)
cfg, err := cfgProvider.readConfig(emptyFolder)
cfg, err := cfgProvider.readConfig(context.Background(), emptyFolder)
require.NoError(t, err)
require.Len(t, cfg, 0)
})
t.Run("Unknown app plugin should return error", func(t *testing.T) {
cfgProvider := newConfigReader(log.New("test logger"), fakePluginStore{})
_, err := cfgProvider.readConfig(unknownApp)
_, err := cfgProvider.readConfig(context.Background(), unknownApp)
require.Error(t, err)
require.Equal(t, "plugin not installed: \"nonexisting\"", err.Error())
})
t.Run("Read incorrect properties", func(t *testing.T) {
cfgProvider := newConfigReader(log.New("test logger"), nil)
_, err := cfgProvider.readConfig(incorrectSettings)
_, err := cfgProvider.readConfig(context.Background(), incorrectSettings)
require.Error(t, err)
require.Equal(t, "app item 1 in configuration doesn't contain required field type", err.Error())
})
@@ -61,7 +61,7 @@ func TestConfigReader(t *testing.T) {
})
cfgProvider := newConfigReader(log.New("test logger"), pm)
cfg, err := cfgProvider.readConfig(correctProperties)
cfg, err := cfgProvider.readConfig(context.Background(), correctProperties)
require.NoError(t, err)
require.Len(t, cfg, 1)