Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions * Fixing build
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3b732fe257
Коммит
1d1ab03c38
@@ -30,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPlugin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
statesJson, _ := json.Marshal(th.App.Config().PluginSettings.PluginStates)
|
||||
@@ -270,7 +270,7 @@ func TestPlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testCluster := &testlib.FakeClusterInterface{}
|
||||
@@ -383,7 +383,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Description, func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -465,7 +465,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMarketplacePlugins(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -582,7 +582,7 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("marketplace client returns not-installed plugin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
@@ -644,7 +644,7 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("marketplace client returns installed plugin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -728,7 +728,7 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
testIconData := fmt.Sprintf("data:image/svg+xml;base64,%s", base64.StdEncoding.EncodeToString(testIcon))
|
||||
|
||||
t.Run("search installed plugin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
@@ -824,7 +824,7 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
samplePlugins := []*model.MarketplacePlugin{
|
||||
@@ -988,7 +988,7 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
marketplacePlugins := []*model.MarketplacePlugin{
|
||||
@@ -1095,7 +1095,7 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -1303,7 +1303,7 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
err = utils.CopyFile(filepath.Join(path, "testplugin.tar.gz.asc"), filepath.Join(prepackagedPluginsDir, "testplugin.tar.gz.sig"))
|
||||
require.NoError(t, err)
|
||||
|
||||
th := SetupConfig(func(cfg *model.Config) {
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
// Disable auto-installing prepackaged plugins
|
||||
*cfg.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
}).InitBasic()
|
||||
@@ -1434,7 +1434,7 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
err = utils.CopyFile(filepath.Join(path, "testplugin.tar.gz"), filepath.Join(prepackagedPluginsDir, "testplugin.tar.gz"))
|
||||
require.NoError(t, err)
|
||||
|
||||
th := SetupConfig(func(cfg *model.Config) {
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
// Disable auto-installing prepackged plugins
|
||||
*cfg.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
}).InitBasic()
|
||||
|
||||
Ссылка в новой задаче
Block a user