Skip to content

Commit

Permalink
Fix plugin install behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Dec 25, 2024
1 parent 3a96ddf commit 8c47f3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 0 additions & 6 deletions cmd/plugin_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,12 +615,6 @@ func installPlugin(
cmd.Println("Plugin name not specified")
return
}

// If pullOnly is true, we're done after verifying the file exists
if pullOnly {
cmd.Println("Plugin file verified at", pluginFilename)
return
}
case SourceGitHub:
// Strip scheme from the plugin URL.
pluginURL = strings.TrimPrefix(strings.TrimPrefix(pluginURL, "http://"), "https://")
Expand Down
6 changes: 3 additions & 3 deletions cmd/plugin_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ func Test_pluginInstallCmdWithFile(t *testing.T) {
pluginTestConfigFile := "./test_plugins_pluginInstallCmdWithFile.yaml"

// Create a test plugin config file.
output, err := executeCommandC(rootCmd, "plugin", "init", "-p", pluginTestConfigFile)
output, err := executeCommandC(
rootCmd, "plugin", "init", "-p", pluginTestConfigFile, "--force")
require.NoError(t, err, "plugin init should not return an error")
assert.Equal(t,
fmt.Sprintf("Config file '%s' was created successfully.", pluginTestConfigFile),
Expand All @@ -33,7 +34,7 @@ func Test_pluginInstallCmdWithFile(t *testing.T) {
// Test plugin install command.
output, err = executeCommandC(
rootCmd, "plugin", "install", "-p", pluginTestConfigFile,
"--update", "--backup", "--name=gatewayd-plugin-cache", pluginArchivePath)
"--backup", "--name=gatewayd-plugin-cache", pluginArchivePath)
require.NoError(t, err, "plugin install should not return an error")
assert.Contains(t, output, "Installing plugin from CLI argument")
assert.Contains(t, output, "Backup completed successfully")
Expand All @@ -56,7 +57,6 @@ func Test_pluginInstallCmdWithFile(t *testing.T) {
assert.NoFileExists(t, "plugins/gatewayd_plugin.yaml")

require.NoError(t, os.RemoveAll("plugins/"))
require.NoError(t, os.Remove(pluginArchivePath))
require.NoError(t, os.Remove(pluginTestConfigFile))
require.NoError(t, os.Remove(pluginTestConfigFile+BackupFileExt))
}
Expand Down

0 comments on commit 8c47f3a

Please sign in to comment.