Skip to content

Commit

Permalink
test: respect XDG_DATA_HOME
Browse files Browse the repository at this point in the history
Signed-off-by: knqyf263 <[email protected]>
  • Loading branch information
knqyf263 committed May 13, 2024
1 parent b69a5a8 commit bf0847d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/plugin/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,24 +443,25 @@ installed:
require.NoError(t, err)

ctx := context.Background()
m := plugin.NewManager()

// verify initial version
verifyVersion(t, ctx, pluginName, "0.0.5")
verifyVersion(t, ctx, m, pluginName, "0.0.5")

// Upgrade the existing plugin
err = plugin.NewManager().Upgrade(ctx, nil)
err = m.Upgrade(ctx, nil)
require.NoError(t, err)

// verify plugin updated
verifyVersion(t, ctx, pluginName, "0.1.0")
verifyVersion(t, ctx, m, pluginName, "0.1.0")
}

func verifyVersion(t *testing.T, ctx context.Context, pluginName, expectedVersion string) {
plugins, err := plugin.LoadAll(ctx)
func verifyVersion(t *testing.T, ctx context.Context, m *plugin.Manager, pluginName, expectedVersion string) {
plugins, err := m.LoadAll(ctx)
require.NoError(t, err)
for _, plugin := range plugins {
if plugin.Name == pluginName {
assert.Equal(t, expectedVersion, plugin.Version)
for _, p := range plugins {
if p.Name == pluginName {
assert.Equal(t, expectedVersion, p.Version)
}
}
}

0 comments on commit bf0847d

Please sign in to comment.