Skip to content

Update integration_test.yml #1

Update integration_test.yml

Update integration_test.yml #1

name: Integration test
on:
push:
branches:
- microshift
env:
GO_VERSION: "1.19"
KIND_VERSION: "0.15.0"
GO111MODULE: "on"
OPERATOR_IMAGE: "quay.io/sustainable_computing_io/kepler-operator"
KUBECONFIG: /tmp/.kube/config
jobs:
build-operator:
name: build-operator
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@main
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
- name: Build operator container
run: make docker-build IMG=${OPERATOR_IMAGE}:latest
- name: Load operator image into cluster
run: |
docker inspect ${OPERATOR_IMAGE}
docker tag ${OPERATOR_IMAGE} ${OPERATOR_IMAGE}:ci-build
- name: Export container image
run: docker save -o /tmp/image.tar ${OPERATOR_IMAGE}
- name: Save container as artifact
uses: actions/upload-artifact@v3
with:
name: kepler-operator
path: /tmp/image.tar
retention-days: 1
e2e:
name: End-to-End Testing
needs: [build-operator]
runs-on: ubuntu-latest
strategy:
matrix:
cluster_provider: [kind, microshift]
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: kepler-operator
- name: Test artifact download
run : |
ls -R
pwd
- name: Import container image into cluster
run: |
docker load -i image.tar
docker inspect ${OPERATOR_IMAGE}
docker tag ${OPERATOR_IMAGE} ${OPERATOR_IMAGE}:ci-build
- name: use kepler action for kind cluster build
uses: sustainable-computing-io/[email protected]
with:
runningBranch: ${{matrix.cluster_provider}}
cluster_provider: ${{matrix.cluster_provider}}
# to do clean up cluster-up and hack folders and move local env set up doc to https://github.com/sustainable-computing-io/kepler-action
- name: Start operator
run: |
export CLUSTER_PROVIDER=${{matrix.cluster_provider}} && make prepareKubeConfig
make deploy
- name: Run e2e tests
run: |
echo "Waiting for all containers to become ready ..."
PODNAME=$(kubectl get pods -n kepler-operator-system | grep kepler-operator-controller-manager | awk '{print $1}')
echo $PODNAME
sleep 10
kubectl describe pod $PODNAME -n kepler-operator-system
kubectl logs $PODNAME -c manager -n kepler-operator-system
kubectl wait --for=condition=Ready pod --all -n kepler-operator-system --timeout 1m
echo "Operator ready ..."
e2e-success:
name: Successful e2e tests
needs: [build-operator , e2e]
runs-on: ubuntu-latest
steps:
- name: Successful
run: echo "Previous steps were successful"
#TO-DO
# Add tests for e2e that checks if all the kepler metrics are present
# kubectl wait --for=condition=Ready pod --all -n kepler-operator-system --timeout 3m
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3