mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #2447 from pwittrock/release
update cmd/config e2e tests with new go function framework
This commit is contained in:
@@ -168,8 +168,6 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main contains a function to be used for e2e testing.
|
||||
//
|
||||
// The function is written using the framework, and parses the ResourceList.functionConfig
|
||||
|
||||
@@ -2,5 +2,4 @@ module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainerconfig
|
||||
|
||||
go 1.14
|
||||
|
||||
require sigs.k8s.io/kustomize/kyaml v0.1.9-0.20200501190629-f7909fad7167
|
||||
|
||||
require sigs.k8s.io/kustomize/kyaml v0.1.10
|
||||
|
||||
@@ -181,3 +181,5 @@ gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
sigs.k8s.io/kustomize/kyaml v0.1.9-0.20200501190629-f7909fad7167 h1:138Q3rZVU5mLBF6dFekNuP6D4ZeF4mndI54RBJ8kK8c=
|
||||
sigs.k8s.io/kustomize/kyaml v0.1.9-0.20200501190629-f7909fad7167/go.mod h1:I4OFZ1vTPdteiqqCBwW3DI0swPzxBpd99y9CHN5IMUU=
|
||||
sigs.k8s.io/kustomize/kyaml v0.1.10 h1:ZZfBnA/kYa9ZxUFIgI9oq3pWKzzA1gGOKgU0Hv/NhVg=
|
||||
sigs.k8s.io/kustomize/kyaml v0.1.10/go.mod h1:mPmeBSRy0LTMv6fSrYSoi2yIFNZVouGKDsTekE5kdhs=
|
||||
|
||||
@@ -25,30 +25,33 @@ type Example struct {
|
||||
// Data contains configuration data for the Example
|
||||
// Nest values under Data so that the function can accept a ConfigMap as its
|
||||
// functionConfig (`run` generates a ConfigMap for the functionConfig when run with --)
|
||||
// e.g. `config run DIR/ --image my-image -- a-string-value=foo` will create the input
|
||||
// with ResourceList.functionConfig.data.a-string-value=foo
|
||||
Data Data `yaml:"data,omitempty"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
functionConfig := &Example{}
|
||||
resourceList := &framework.ResourceList{FunctionConfig: functionConfig}
|
||||
|
||||
cmd := framework.Command(functionConfig, func(items []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
for i := range items {
|
||||
if err := items[i].PipeE(yaml.SetAnnotation("a-string-value",
|
||||
cmd := framework.Command(resourceList, func() error {
|
||||
for i := range resourceList.Items {
|
||||
if err := resourceList.Items[i].PipeE(yaml.SetAnnotation("a-string-value",
|
||||
functionConfig.Data.StringValue)); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
if err := items[i].PipeE(yaml.SetAnnotation("a-int-value",
|
||||
if err := resourceList.Items[i].PipeE(yaml.SetAnnotation("a-int-value",
|
||||
fmt.Sprintf("%v", functionConfig.Data.IntValue))); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
if err := items[i].PipeE(yaml.SetAnnotation("a-bool-value",
|
||||
if err := resourceList.Items[i].PipeE(yaml.SetAnnotation("a-bool-value",
|
||||
fmt.Sprintf("%v", functionConfig.Data.BoolValue))); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
}
|
||||
return items, nil
|
||||
return nil
|
||||
})
|
||||
|
||||
if err := cmd.Execute(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user