Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for out-of-place sink #2081

Merged
merged 2 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions e2e/testdata/fn-eval/out-of-place/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/resources.yaml b/resources.yaml
index 7a494c9..254b9cd 100644
--- a/resources.yaml
+++ b/resources.yaml
@@ -15,6 +15,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
+ namespace: staging
spec:
replicas: 3
---
@@ -22,5 +23,6 @@ apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
+ namespace: staging
spec:
image: nginx:1.2.3
29 changes: 29 additions & 0 deletions e2e/testdata/fn-eval/out-of-place/.expected/exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/bash
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

# create a temporary directory
TEMP_DIR=$(mktemp -d)

kpt fn source \
| kpt fn eval - --image gcr.io/kpt-fn/set-namespace:v0.1 -- namespace=staging \
| kpt fn sink $TEMP_DIR

# copy back the resources
cp $TEMP_DIR/* .
Shell32-Natsu marked this conversation as resolved.
Show resolved Hide resolved

# remove temporary directory
rm -r $TEMP_DIR
1 change: 1 addition & 0 deletions e2e/testdata/fn-eval/out-of-place/.krmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.expected
26 changes: 26 additions & 0 deletions e2e/testdata/fn-eval/out-of-place/resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
---
apiVersion: custom.io/v1
kind: Custom
metadata:
name: custom
spec:
image: nginx:1.2.3