Skip to content

Commit

Permalink
Merge pull request #20 from kyma-project/e2e
Browse files Browse the repository at this point in the history
E2e
  • Loading branch information
kyma-bot authored Aug 14, 2024
2 parents 28d2295 + 3581266 commit 4f031b5
Show file tree
Hide file tree
Showing 23 changed files with 874 additions and 1,785 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
shoots: ${{ steps.shoots.outputs.shoots }}
shoots: ${{ steps.define.outputs.shoots }}
env: ${{ steps.define.outputs.env }}
steps:
- uses: actions/checkout@v4
- name: Find Shoots
id: shoots
id: define
run: |
SHOOTS=`jq -c ".skrs.${{ inputs.environment }} | keys_unsorted " ./assets/config.json`
ENV="${${{ inputs.environment }}:-dev}"
echo "env=$ENV"
SHOOTS=`jq -c ".skrs.$ENV | keys_unsorted " ./assets/config.json`
echo "shoots=$SHOOTS"
echo "env=$ENV" >> "$GITHUB_OUTPUT"
echo "shoots=$SHOOTS" >> "$GITHUB_OUTPUT"
run-tests:
Expand All @@ -29,7 +33,7 @@ jobs:
strategy:
matrix:
shoot: ${{ fromJSON(needs.define-matrix.outputs.shoots) }}
environment: ${{ inputs.environment }}
environment: ${{ needs.define-matrix.outputs.env }}
steps:
- name: Print shoot
run: echo ${{ matrix.shoot }}
Expand Down Expand Up @@ -68,10 +72,22 @@ jobs:
BTP_URL: ${{ vars.BTP_URL }}
BTP_SUBDOMAIN: ${{ vars.BTP_SUBDOMAIN }}
BTP_IDP: ${{ vars.BTP_IDP }}
SKRS: ${{ vars.SKRS }}
run: |
URL=$(jq -r '.skrs.${{ inputs.environment }}.${{ matrix.shoot }}.url' ./assets/config.json)
CA=$(jq -r '.skrs.${{ inputs.environment }}.${{ matrix.shoot }}.ca' ./assets/config.json)
URL=$(jq -r '.skrs.${{ needs.define-matrix.outputs.env }}.${{ matrix.shoot }}.url' ./assets/config.json)
echo "URL: $URL"
CA=$(jq -r '.skrs.${{ needs.define-matrix.outputs.env }}.${{ matrix.shoot }}.ca' ./assets/config.json)
TOKEN=$(jq -r '.id_token' ./token.json)
KC=$(jq ".users[0].user.token = \"$TOKEN\" | .clusters[0].cluster.server = \"$URL\" | .clusters[0].cluster.\"certificate-authority-data\" = \"$CA\"" ./assets/kubeconfig.json)
kubectl config view --minify --raw --kubeconfig <(echo $KC) > kubeconfig.yaml
- name: Run E2E Tests
run: |
export SHOOT="${{ matrix.shoot }}"
export PROVIDER=$(jq -r '.skrs.${{ needs.define-matrix.outputs.env }}.${{ matrix.shoot }}.provider' ./assets/config.json)
export KUBECONFIG=$(pwd)/kubeconfig.yaml
export ENV=${{ needs.define-matrix.outputs.env }}
echo "shoot=$SHOOT"
echo "provider=$PROVIDER"
echo "env=$ENV"
./bin/kfr \
-godog.paths $(pwd)/features \
-godog.tags="@all,@allProviders,@$PROVIDER&&@all,@allShoots,@${{ matrix.shoot }}&&@all,@allEnvs,@$ENV"
6 changes: 6 additions & 0 deletions assets/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
"skrs": {
"dev": {
"a31a7ed": {
"provider": "aws",
"url": "https://api.a31a7ed.dev.kyma.ondemand.com",
"ca": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUQ1ekNDQWsrZ0F3SUJBZ0lSQVAra1ZtTzE2M1hRdEthZUpIVVFrbnd3RFFZSktvWklodmNOQVFFTEJRQXcKRFRFTE1Ba0dBMVVFQXhNQ1kyRXdIaGNOTWpRd016QTFNVFF3T0RRMVdoY05NelF3TXpBMU1UUXdPRFExV2pBTgpNUXN3Q1FZRFZRUURFd0pqWVRDQ0FhSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnR1BBRENDQVlvQ2dnR0JBTGRzCnhSNTU1VWU0OVprazMxcmh5Ri85Nmk1TnBDOUx6ZEFJRCtpemhpTVFwRldqMCtDaG1HZHRlajFyR0lkNEQ4MWoKZTRoTDk5UWE3UnRU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UakZ4cnNMa0dOUm1UWm9GZDVGeGNBaUlnZ1NraEkxUlh6SnBDVVVYVjgKZ3JzYXpDR2tlcG1UT2llTHNLcXdoTnlYcGlVOWpURXJLcGlDSHNlWG5wME1BQ3BYUWN0b3lGRlJXQ0VuOTBuSwp6YUZrbm5DdEIvU25LYTQwY0tHTEhYNFAydUZzMWNjYTYyM2dOWVdzbEZmY3dQSEpNbUZGc212TgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions assets/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: phoenix
subjects:
- kind: Group
apiGroup: rbac.authorization.k8s.io
name: phx-skr-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
"github.com/kyma-project/cloud-manager-tests/internal"
"github.com/onsi/gomega"
"github.com/tmilos/k8s-feature-runner/internal"
"os"
"time"
)
Expand Down
46 changes: 46 additions & 0 deletions features/000-module.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Feature: Module enable feature

@all
Scenario: Module enable scenario
Given resource declaration:
| kyma | Kyma | "default" | "kyma-system" |
| cm | CloudResources | "default" | "kyma-system" |
Given there are no cloud resources
And module is removed
When module is added
Then eventually value load("cm").status.state equals "Ready"


@aws @allShoots @dev
Scenario: Installed CRDs
When CRDs are loaded
Then CRDs exist:
| IpRange |
| AwsNfsVolume |
| AwsVpcPeering |
| AwsRedisInstance |
And CRDs do not exist:
| GcpNfsVolume |
| GcpNfsVolumeBackup |
| GcpNfsVolumeRestore |
| GcpRedisInstance |
| GcpVpcPeering |
| AzureVpcPeering |
| AzureRedisInstance |

@gcp @allShoots @dev
Scenario: Installed CRDs
When CRDs are loaded
Then CRDs exist:
| IpRange |
| GcpNfsVolume |
| GcpNfsVolumeBackup |
| GcpNfsVolumeRestore |
| GcpRedisInstance |
| GcpVpcPeering |
And CRDs do not exist:
| AwsNfsVolume |
| AwsVpcPeering |
| AwsRedisInstance |
| AzureVpcPeering |
| AzureRedisInstance |
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Feature: AwsNfsVolume feature

@aws @allShoots @allEnvs
Scenario: AwsNfsVolume scenario
Given resource declaration:
| vol | AwsNfsVolume | "vol-"+rndStr(8) | namespace |
| vol | AwsNfsVolume | "vol-"+rndStr(8) | namespace |
| pv | PersistentVolume | vol.status.id | |
| pvc | PersistentVolumeClaim | vol.metadata.name | namespace |
| pod | Pod | "test-vol" | namespace |
Expand Down
54 changes: 54 additions & 0 deletions features/200-gcpnfsvolume.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Feature: GcpNfsVolume feature

@gcp @allShoots @allEnvs
Scenario: GcpNfsVolume scenario
Given resource declaration:
| vol | GcpNfsVolume | "vol-"+rndStr(8) | namespace |
| pv | PersistentVolume | vol.status.id | |
| pvc | PersistentVolumeClaim | vol.metadata.name | namespace |
| pod | Pod | "test-vol" | namespace |
When resource vol is applied:
"""
apiVersion: cloud-resources.kyma-project.io/v1beta1
kind: GcpNfsVolume
spec:
capacityGb: 1024
"""
Then eventually value load("vol").status.state equals "Ready"
And eventually value load("pv").status.phase equals "Bound"
And eventually value load("pvc").status.phase equals "Bound"

When resource pod is applied:
"""
apiVersion: v1
kind: Pod
spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: <(vol.metadata.name)>
containers:
- name: cloud1
image: ubuntu
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: "/mnt/data1"
name: data
command:
- "/bin/bash"
- "-c"
- "--"
args:
- "echo 'test line' > /mnt/data1/test.txt & cat /mnt/data1/test.txt"
restartPolicy: Never
"""
Then eventually value load("pod").status.phase equals "Succeeded"
And value logs("pod").search(/test line/) > -1 equals true

When resource pod is deleted
Then eventually resource pod does not exist

When resource vol is deleted
Then eventually resource pvc does not exist
And eventually resource pv does not exist
And eventually resource vol does not exist
35 changes: 0 additions & 35 deletions features/global.js

This file was deleted.

22 changes: 0 additions & 22 deletions features/main.feature

This file was deleted.

7 changes: 0 additions & 7 deletions features/module.feature

This file was deleted.

9 changes: 1 addition & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
module github.com/tmilos/k8s-feature-runner
module github.com/kyma-project/cloud-manager-tests

go 1.22.5

require (
github.com/cucumber/godog v0.14.1
github.com/dop251/goja v0.0.0-20240804150220-aafb077cb27b
github.com/google/cel-go v0.20.1
github.com/onsi/gomega v1.34.0
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.30.3
)

require (
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect
github.com/cucumber/messages/go/v21 v21.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand All @@ -33,13 +31,8 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
Expand Down
Loading

0 comments on commit 4f031b5

Please sign in to comment.