mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-08 14:29:45 +00:00
kubectl plugin: Expand environment variables in the command of plugin.yaml
This commit improves kubectl plugins to expand environment variables in the command of plugin.yaml.
This commit is contained in:
@@ -18,6 +18,7 @@ package plugins
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -38,8 +39,16 @@ func TestExecRunner(t *testing.T) {
|
||||
command: "false",
|
||||
expectedErr: "exit status 1",
|
||||
},
|
||||
{
|
||||
name: "env",
|
||||
command: "echo $KUBECTL_PLUGINS_TEST",
|
||||
expectedMsg: "ok\n",
|
||||
},
|
||||
}
|
||||
|
||||
os.Setenv("KUBECTL_PLUGINS_TEST", "ok")
|
||||
defer os.Unsetenv("KUBECTL_PLUGINS_TEST")
|
||||
|
||||
for _, test := range tests {
|
||||
outBuf := bytes.NewBuffer([]byte{})
|
||||
|
||||
|
Reference in New Issue
Block a user