Skip to content

Commit

Permalink
Continue on error test (#1370)
Browse files Browse the repository at this point in the history
* WIP: Continue on error test

* Update continue-on-error test
  • Loading branch information
runewake2 committed Feb 8, 2021
1 parent dd84ec2 commit 1a13ac1
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
9 changes: 9 additions & 0 deletions e2e/live/end-to-end-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,15 @@ assertPodNotExists "pod-c" "test-namespace"
assertPodNotExists "pod-d" "test-namespace"
printResult

# Test 20: kpt live apply continue-on-error
echo "Testing continue-on-error"
echo "kpt live apply e2e/live/testdata/continue-on-error"
${BIN_DIR}/kpt live apply e2e/live/testdata/continue-on-error > $OUTPUT_DIR/status
assertCMInventory "test-namespace" "1"
assertPodExists "pod-a" "test-namespace"
assertPodNotExists "pod-B" "test-namespace"
printResult

# Clean-up the k8s cluster
echo "Cleaning up cluster"
kind delete cluster
Expand Down
6 changes: 6 additions & 0 deletions e2e/live/testdata/continue-on-error/Kptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kpt.dev/v1alpha1
kind: Kptfile
metadata:
name: continue-on-error
packageMetadata:
shortDescription: sample description
34 changes: 34 additions & 0 deletions e2e/live/testdata/continue-on-error/inventory-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# NOTE: auto-generated. Some fields should NOT be modified.
# Date: 2021-01-15 15:23:11 PST
#
# Contains the "inventory object" template ConfigMap.
# When this object is applied, it is handled specially,
# storing the metadata of all the other objects applied.
# This object and its stored inventory is subsequently
# used to calculate the set of objects to automatically
# delete (prune), when an object is omitted from further
# applies. When applied, this "inventory object" is also
# used to identify the entire set of objects to delete.
#
# NOTE: The name of this inventory template file
# does NOT have any impact on group-related functionality
# such as deletion or pruning.
#
apiVersion: v1
kind: ConfigMap
metadata:
# DANGER: Do not change the inventory object namespace.
# Changing the namespace will cause a loss of continuity
# with previously applied grouped objects. Set deletion
# and pruning functionality will be impaired.
namespace: test-namespace
# NOTE: The name of the inventory object does NOT have
# any impact on group-related functionality such as
# deletion or pruning.
name: inventory-10220562
labels:
# DANGER: Do not change the value of this label.
# Changing this value will cause a loss of continuity
# with previously applied grouped objects. Set deletion
# and pruning functionality will be impaired.
cli-utils.sigs.k8s.io/inventory-id: 3da10960-c1d8-46ae-988e-f330acdc8e15
7 changes: 7 additions & 0 deletions e2e/live/testdata/continue-on-error/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0

apiVersion: v1
kind: Namespace
metadata:
name: test-namespace
13 changes: 13 additions & 0 deletions e2e/live/testdata/continue-on-error/pod-a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This pod description should be valid and is expected to successfully deploy

apiVersion: v1
kind: Pod
metadata:
name: pod-a
namespace: test-namespace
labels:
name: test-pod-label-foo
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0
16 changes: 16 additions & 0 deletions e2e/live/testdata/continue-on-error/pod-b.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This pod definition has errors and will fail to deploy

apiVersion: v1
kind: Pod
metadata:
# It is invalid for a pod to be named with a capital letter
# Expected error:
# The Pod "pod-B" is invalid: metadata.name: Invalid value: "pod-B"
name: pod-B
namespace: test-namespace
labels:
name: test-pod-label-foo
spec:
containers:
- name: kubernetes-pause
image: k8s.gcr.io/pause:2.0

0 comments on commit 1a13ac1

Please sign in to comment.