Skip to content

ci(e2e-testing): Add end-to-end test pipeline #2

ci(e2e-testing): Add end-to-end test pipeline

ci(e2e-testing): Add end-to-end test pipeline #2

Workflow file for this run

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Test E2E
on:
# Manual Trigger
workflow_dispatch: {}
# Run on any PR that changes this pipeline or that should ultimately trigger a release when merged
pull_request:
paths:
- ".github/workflows/test.yaml"
- "go.mod"
- "go.sum"
- "**/**.go"
env:
KUBECONFIG_DIR: ./configs/
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Build `kube-switcher`
run: go build -o kube-switcher
- name: Install `minikube`
run: |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
- name: Set Up Kubernetes Clusters
run: |
KUBECONFIG=./configs/cluster1.yaml minikube start -p test-cluster-1 &
KUBECONFIG=./configs/cluster2.yaml minikube start -p test-cluster-2 &
wait
- name: Run kube-switcher - switch cluster context
run: ./kube-switcher context test-cluster-1
- name: List Kubernetes Nodes
run: kubectl get nodes | grep "test-cluster-1"
- name: Run kube-switcher - switch cluster namespace
run: |
kubectl get pods | grep "No resources found in default namespace."
./kube-switcher namespace kube-system
kubectl get pods | grep "apiserver"
- name: Run kube-switcher - switch context shorthand
run: |
./kube-switcher ns default
kubectl get pods | grep "No resources found in default namespace."
- name: Run kube-switcher - switch cluster shorthand
run: ./kube-switcher ctx test-cluster-2
- name: List Kubernetes Nodes
run: kubectl get nodes | grep "test-cluster-2"