Skip to content

Commit

Permalink
add a plugin
Browse files Browse the repository at this point in the history
Signed-off-by: nitishfy <[email protected]>
  • Loading branch information
nitishfy committed Oct 1, 2024
1 parent 16b46c4 commit c6d4f20
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/argocd/commands/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (t *testPluginHandler) LookForPlugin(filename string) (string, bool) {
return "", false
}

func (t testPluginHandler) ExecutePlugin(executablePath string, cmdArgs, environment []string) error {
func (t *testPluginHandler) ExecutePlugin(executablePath string, cmdArgs, environment []string) error {
t.executed = true
t.executedPlugin = executablePath
t.withArgs = cmdArgs
Expand All @@ -81,6 +81,12 @@ func Test_ArgoCDPluginHandler(t *testing.T) {
expectedPlugin: "",
expectPluginArgs: []string{},
},
{
name: "test that a plugin executable is found based on command args",
args: []string{"argocd", "foo"},
expectedPlugin: "testdata/argocd-foo",
expectPluginArgs: []string{},
},
}

for _, tt := range tests {
Expand Down
18 changes: 18 additions & 0 deletions cmd/argocd/commands/testdata/argocd-foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# optional argument handling
if [[ "$1" == "version" ]]
then
echo "1.0.0"
exit 0
fi

# optional argument handling
if [[ "$1" == "config" ]]
then
echo "$KUBECONFIG"
exit 0
fi

echo "I am a plugin named argocd-foo"

0 comments on commit c6d4f20

Please sign in to comment.