mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 09:24:23 +00:00
Put goplugins behind flag.
This commit is contained in:
@@ -14,6 +14,9 @@ limitations under the License.
|
||||
package target_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"sigs.k8s.io/kustomize/pkg/types"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -69,3 +72,47 @@ metadata:
|
||||
name: shouldNotHaveHash
|
||||
`)
|
||||
}
|
||||
|
||||
func TestGoPluginNotEnabled(t *testing.T) {
|
||||
th := NewKustTestHarness(t, "/app")
|
||||
th.writeK("/app", `
|
||||
secretGenerator:
|
||||
- name: attemptGoPlugin
|
||||
kvSources:
|
||||
- name: foo
|
||||
pluginType: go
|
||||
args:
|
||||
- someArg
|
||||
- someOtherArg
|
||||
`)
|
||||
_, err := th.makeKustTarget().MakeCustomizedResMap()
|
||||
if err == nil {
|
||||
t.Fatalf("expected error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "enable go plugins by ") {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGoPluginDoesNotExist(t *testing.T) {
|
||||
th := NewKustTestHarnessWithPluginConfig(
|
||||
t, "/app", types.PluginConfig{GoEnabled: true})
|
||||
th.writeK("/app", `
|
||||
secretGenerator:
|
||||
- name: attemptGoPlugin
|
||||
kvSources:
|
||||
- name: foo
|
||||
pluginType: go
|
||||
args:
|
||||
- someArg
|
||||
- someOtherArg
|
||||
`)
|
||||
_, err := th.makeKustTarget().MakeCustomizedResMap()
|
||||
if err == nil {
|
||||
t.Fatalf("expected error")
|
||||
}
|
||||
if !strings.Contains(err.Error(),
|
||||
filepath.Join("kvSources", "foo.so")) {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user