Skip to content

Commit

Permalink
fix for backtick escape error (#358)
Browse files Browse the repository at this point in the history
* fix for backtick escape error

* rebased from upstream/master
  • Loading branch information
Kam Kasravi authored and k8s-ci-robot committed Sep 16, 2019
1 parent caea56c commit d47d06a
Show file tree
Hide file tree
Showing 20 changed files with 17,741 additions and 24 deletions.
17 changes: 10 additions & 7 deletions hack/gen-test-target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ kebab-case-2-PascalCase() {

gen-target-start() {
local dir=$(get-target $1) target fname
fname=/manifests${dir##*/manifests}
fname=/manifests${dir#*/manifests}
target=$(kebab-case-2-PascalCase $(get-target-name $1))
#echo 'gen-target-start dir='$dir' fname='$fname' target='$target

echo 'package tests_test'
echo ''
Expand Down Expand Up @@ -79,16 +80,17 @@ gen-target() {

gen-target-base() {
echo ' th.writeK("'$kname'", `'
cat $dir/$file | sed 'sx- ../../basex- '$basedir'x'
cat $dir/$file | sed 'sx- ../../basex- '$basedir'x' | sed 's/`/`+"`"+`/g'
echo '`)'
}

gen-target-kustomization() {
local file=$1 dir=$2 fname kname basedir
fname=/manifests${dir##*/manifests}
fname=/manifests${dir#*/manifests}
kname=${fname%/kustomization.yaml}
#echo 'gen-target-kustomization file='$file' dir='$dir' fname='$fname' kname='$kname
echo ' th.writeK("'$kname'", `'
cat $dir/$file
cat $dir/$file | sed 's/`/`+"`"+`/g'
echo '`)'
if [[ $(get-target-dirname $dir) != "base" ]]; then
basedir=$(get-target $dir)/base
Expand All @@ -100,20 +102,21 @@ gen-target-kustomization() {

gen-target-resource() {
local file=$1 dir=$2 echooptions='' fname
fname=/manifests${dir##*/manifests}/$file
fname=/manifests${dir#*/manifests}/$file
if (( $# == 3 )); then
echooptions=$3
fi
echo $echooptions ' th.writeF("'$fname'", `'
cat $dir/$file | sed 's/`/U+0060/g'
cat $dir/$file | sed 's/`/`+"`"+`/g'
echo '`)'
}

gen-test-case() {
local base=$(get-target-name $1) dir=$(get-target $1) target fname
fname=/manifests${dir##*/manifests}/$(get-target-dirname $1)
fname=/manifests${dir#*/manifests}/$(get-target-dirname $1)
target=$(kebab-case-2-PascalCase $base)
targetPath=..${1#*/manifests}
#echo 'gen-test-case base='$base' dir='$dir' fname='$fname' target='$target' targetPath='$targetPath

gen-target $1
echo ''
Expand Down
2 changes: 1 addition & 1 deletion hack/gen-test-targets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ for i in $(find * -type d -exec sh -c '(ls -p "{}"|grep />/dev/null)||echo "{}"'
if [[ ! $absdir =~ overlays/test$ ]]; then
testname=$(get-target-name $absdir)_test.go
echo generating $testname from manifests/${absdir#*manifests/}
./hack/gen-test-target.sh $absdir > tests/$testname
./hack/gen-test-target.sh $absdir 1> tests/$testname
fi
done
2 changes: 1 addition & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GOLANG_VERSION ?= 1.12.4
GOPATH ?= $(HOME)/go

# Comma seperated items within {} for more than one file
EXCLUDE ?= istio-install-base_test.go
# EXCLUDE ?= istio-install-base_test.go

export GO111MODULE = on
export GO = go
Expand Down
3 changes: 2 additions & 1 deletion tests/basic-auth-ingress-overlays-certmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ resources:
- certificate.yaml
namespace: kubeflow
commonLabels:
kustomize.component: basic-auth-ingress`)
kustomize.component: basic-auth-ingress
`)
th.writeF("/manifests/gcp/basic-auth-ingress/base/cloud-endpoint.yaml", `
apiVersion: ctl.isla.solutions/v1
kind: CloudEndpoint
Expand Down
3 changes: 2 additions & 1 deletion tests/basic-auth-ingress-overlays-gcp-credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ kind: Kustomization
bases:
- ../../base
patchesStrategicMerge:
- gcp-credentials-patch.yaml`)
- gcp-credentials-patch.yaml
`)
th.writeF("/manifests/gcp/basic-auth-ingress/base/cloud-endpoint.yaml", `
apiVersion: ctl.isla.solutions/v1
kind: CloudEndpoint
Expand Down
3 changes: 2 additions & 1 deletion tests/basic-auth-ingress-overlays-managed-cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ resources:
- cert.yaml
namespace: kubeflow
commonLabels:
kustomize.component: basic-auth-ingress`)
kustomize.component: basic-auth-ingress
`)
th.writeF("/manifests/gcp/basic-auth-ingress/base/cloud-endpoint.yaml", `
apiVersion: ctl.isla.solutions/v1
kind: CloudEndpoint
Expand Down
3 changes: 2 additions & 1 deletion tests/cloud-endpoints-overlays-gcp-credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ kind: Kustomization
bases:
- ../../base
patchesStrategicMerge:
- gcp-credentials-patch.yaml`)
- gcp-credentials-patch.yaml
`)
th.writeF("/manifests/gcp/cloud-endpoints/base/cluster-role-binding.yaml", `
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
Expand Down
3 changes: 2 additions & 1 deletion tests/iap-ingress-base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ vars:
fieldref:
fieldpath: data.istioNamespace
configurations:
- params.yaml`)
- params.yaml
`)
}

func TestIapIngressBase(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion tests/iap-ingress-overlays-certmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ vars:
fieldref:
fieldpath: data.istioNamespace
configurations:
- params.yaml`)
- params.yaml
`)
}

func TestIapIngressOverlaysCertmanager(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion tests/iap-ingress-overlays-gcp-credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,8 @@ vars:
fieldref:
fieldpath: data.istioNamespace
configurations:
- params.yaml`)
- params.yaml
`)
}

func TestIapIngressOverlaysGcpCredentials(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion tests/iap-ingress-overlays-managed-cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ vars:
fieldref:
fieldpath: data.istioNamespace
configurations:
- params.yaml`)
- params.yaml
`)
}

func TestIapIngressOverlaysManagedCert(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion tests/istio-ingress-overlays-cognito_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ vars:
fieldref:
fieldpath: data.certArn
configurations:
- params.yaml`)
- params.yaml
`)
th.writeF("/manifests/aws/istio-ingress/base/ingress.yaml", `
apiVersion: extensions/v1beta1
kind: Ingress
Expand Down
3 changes: 2 additions & 1 deletion tests/istio-ingress-overlays-oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ vars:
fieldref:
fieldpath: data.certArn
configurations:
- params.yaml`)
- params.yaml
`)
th.writeF("/manifests/aws/istio-ingress/base/ingress.yaml", `
apiVersion: extensions/v1beta1
kind: Ingress
Expand Down
Loading

0 comments on commit d47d06a

Please sign in to comment.