-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate e2e tests from kuttl to chainsaw
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
- Loading branch information
1 parent
b31ea78
commit 8d7e679
Showing
15 changed files
with
395 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Configuration | ||
metadata: | ||
name: configuration-local | ||
spec: | ||
timeouts: | ||
assert: 5m | ||
cleanup: 5m | ||
error: 5m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Configuration | ||
metadata: | ||
name: configuration | ||
spec: | ||
skipDelete: true | ||
timeouts: | ||
assert: 6m40s | ||
cleanup: 6m40s | ||
error: 6m40s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test-chainsaw/allowed-namespaces/simple-deployment-allowed/00-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test | ||
name: test | ||
namespace: allowed-ns-test | ||
status: | ||
readyReplicas: 2 |
50 changes: 50 additions & 0 deletions
50
test-chainsaw/allowed-namespaces/simple-deployment-allowed/00-install.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: allowed-ns-test | ||
annotations: | ||
keptn.sh/lifecycle-toolkit: enabled | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnTaskDefinition | ||
metadata: | ||
name: pre-deployment-hello | ||
namespace: allowed-ns-test | ||
spec: | ||
function: | ||
inline: | ||
code: | | ||
console.log("Pre-Deployment Task has been executed"); | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test | ||
name: test | ||
namespace: allowed-ns-test | ||
annotations: | ||
keptn.sh/workload: waiter | ||
keptn.sh/version: "0.4" | ||
keptn.sh/pre-deployment-tasks: pre-deployment-hello | ||
keptn.sh/post-deployment-tasks: pre-deployment-hello | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: test | ||
strategy: {} | ||
template: | ||
metadata: | ||
labels: | ||
app: test | ||
spec: | ||
containers: | ||
- image: busybox | ||
name: busybox | ||
command: ['sh', '-c', 'echo The app is running! && sleep infinity'] | ||
initContainers: | ||
- name: init-myservice | ||
image: busybox:1.36.1 | ||
command: ['sh', '-c', 'sleep 10'] |
24 changes: 24 additions & 0 deletions
24
test-chainsaw/allowed-namespaces/simple-deployment-allowed/01-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnWorkload | ||
metadata: | ||
name: waiter-waiter | ||
namespace: allowed-ns-test | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnWorkloadVersion | ||
metadata: | ||
name: waiter-waiter-0.4 | ||
namespace: allowed-ns-test | ||
status: | ||
currentPhase: Completed | ||
deploymentStatus: Succeeded | ||
postDeploymentEvaluationStatus: Succeeded | ||
postDeploymentStatus: Succeeded | ||
postDeploymentTaskStatus: | ||
- status: Succeeded | ||
definitionName: pre-deployment-hello | ||
preDeploymentEvaluationStatus: Succeeded | ||
preDeploymentStatus: Succeeded | ||
preDeploymentTaskStatus: | ||
- status: Succeeded | ||
definitionName: pre-deployment-hello |
18 changes: 18 additions & 0 deletions
18
test-chainsaw/allowed-namespaces/simple-deployment-allowed/chainsaw-test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: simple-deployment-allowed | ||
spec: | ||
steps: | ||
- name: step-00 | ||
try: | ||
- apply: | ||
file: 00-install.yaml | ||
- assert: | ||
file: 00-assert.yaml | ||
- name: step-01 | ||
try: | ||
- assert: | ||
file: 01-assert.yaml |
9 changes: 9 additions & 0 deletions
9
test-chainsaw/allowed-namespaces/simple-deployment-not-allowed/00-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test | ||
name: test | ||
namespace: not-allowed-ns-test | ||
status: | ||
readyReplicas: 2 |
50 changes: 50 additions & 0 deletions
50
test-chainsaw/allowed-namespaces/simple-deployment-not-allowed/00-install.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: not-allowed-ns-test | ||
annotations: | ||
keptn.sh/lifecycle-toolkit: enabled | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnTaskDefinition | ||
metadata: | ||
name: pre-deployment-hello | ||
namespace: not-allowed-ns-test | ||
spec: | ||
function: | ||
inline: | ||
code: | | ||
console.log("Pre-Deployment Task has been executed"); | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test | ||
name: test | ||
namespace: not-allowed-ns-test | ||
annotations: | ||
keptn.sh/workload: waiter | ||
keptn.sh/version: "0.4" | ||
keptn.sh/pre-deployment-tasks: pre-deployment-hello | ||
keptn.sh/post-deployment-tasks: pre-deployment-hello | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: test | ||
strategy: {} | ||
template: | ||
metadata: | ||
labels: | ||
app: test | ||
spec: | ||
containers: | ||
- image: busybox | ||
name: busybox | ||
command: ['sh', '-c', 'echo The app is running! && sleep infinity'] | ||
initContainers: | ||
- name: init-myservice | ||
image: busybox:1.36.1 | ||
command: ['sh', '-c', 'sleep 10'] |
35 changes: 35 additions & 0 deletions
35
test-chainsaw/allowed-namespaces/simple-deployment-not-allowed/chainsaw-test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: simple-deployment-not-allowed | ||
spec: | ||
steps: | ||
- name: step-00 | ||
try: | ||
- apply: | ||
file: 00-install.yaml | ||
- assert: | ||
file: 00-assert.yaml | ||
- name: step-01 | ||
try: | ||
# we expect none of these resources to be present | ||
- error: | ||
resource: | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnTask | ||
metadata: | ||
namespace: not-allowed-ns-test | ||
- error: | ||
resource: | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnWorkload | ||
metadata: | ||
namespace: not-allowed-ns-test | ||
- error: | ||
resource: | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnApp | ||
metadata: | ||
namespace: not-allowed-ns-test |
20 changes: 20 additions & 0 deletions
20
test-chainsaw/scheduling-gates/simple-deployment/00-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test | ||
name: test | ||
status: | ||
readyReplicas: 1 | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
annotations: | ||
keptn.sh/scheduling-gate-removed: "true" | ||
labels: | ||
app: test | ||
spec: | ||
schedulerName: default-scheduler | ||
status: | ||
phase: Running |
40 changes: 40 additions & 0 deletions
40
test-chainsaw/scheduling-gates/simple-deployment/00-install.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnTaskDefinition | ||
metadata: | ||
name: pre-deployment-hello | ||
spec: | ||
function: | ||
inline: | ||
code: | | ||
console.log("Pre-Deployment Task has been executed"); | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: test | ||
name: test | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: test | ||
strategy: {} | ||
template: | ||
metadata: | ||
labels: | ||
app: test | ||
annotations: | ||
keptn.sh/workload: waiter | ||
keptn.sh/version: "0.4" | ||
keptn.sh/pre-deployment-tasks: pre-deployment-hello | ||
keptn.sh/post-deployment-tasks: pre-deployment-hello | ||
spec: | ||
containers: | ||
- image: busybox | ||
name: busybox | ||
command: ['sh', '-c', 'echo The app is running! && sleep infinity'] | ||
initContainers: | ||
- name: init-myservice | ||
image: busybox:1.36.1 | ||
command: ['sh', '-c', 'sleep 30'] |
32 changes: 32 additions & 0 deletions
32
test-chainsaw/scheduling-gates/simple-deployment/01-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnWorkload | ||
metadata: | ||
name: waiter-waiter | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnWorkloadVersion | ||
metadata: | ||
name: waiter-waiter-0.4 | ||
status: | ||
currentPhase: Completed | ||
deploymentStatus: Succeeded | ||
postDeploymentEvaluationStatus: Succeeded | ||
postDeploymentStatus: Succeeded | ||
postDeploymentTaskStatus: | ||
- definitionName: pre-deployment-hello | ||
status: Succeeded | ||
preDeploymentEvaluationStatus: Succeeded | ||
preDeploymentStatus: Succeeded | ||
preDeploymentTaskStatus: | ||
- definitionName: pre-deployment-hello | ||
status: Succeeded | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnApp | ||
metadata: | ||
name: waiter | ||
--- | ||
apiVersion: lifecycle.keptn.sh/v1beta1 | ||
kind: KeptnAppVersion | ||
metadata: | ||
name: waiter-0.4-6b86b273 |
Oops, something went wrong.