Skip to content

Commit

Permalink
temp: integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Sep 19, 2024
1 parent 0e18e0c commit 2b5a9cc
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 4 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Integration Test

on:
pull_request:

jobs:

k8s:
runs-on: ubuntu-latest
strategy:
matrix:
cluster:
- cluster-01

steps:
- name: Checkout
uses: actions/checkout@v4

- name: start minikube
id: minikube
uses: medyagh/setup-minikube@latest

- name: Setup namespace
run: |
kubectl config set-context --current --namespace=openedx-harmony
- name: Helm dependency add
run: |
helm dependency list charts/harmony-chart 2> /dev/null | tail +2 | awk '{ print "helm" " repo add " $1 " " $3 }' | while read cmd; do $cmd || true; done
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.1/cert-manager.crds.yaml --namespace=harmony
- name: Helm dependency build
run: |
helm dependency update charts/harmony-chart
helm dependency build charts/harmony-chart
- name: Helm install
run: |
helm install harmony --namespace harmony --create-namespace -f integration-test/${{matrix.cluster}}/values.yaml charts/harmony-chart
- name: Setup domain
run: |
export CLUSTER_HTTP_URL=$(minikube service harmony-ingress-nginx-controller -n harmony --url | head -n 1)
curl $CLUSTER_HTTP_URL/cluster-echo-test -H "host: harmony.test"
- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install openedx
run: |
export INSTALLATIONS=$(ls -d integration-test/${{matrix.cluster}}/*/)
export CI_ROOT=$(pwd)
for i in $(ls -d integration-test/cluster-01/*/)
do
echo "Running for installation $i"
cd $i
export TUTOR_PLUGINS_ROOT=$(pwd)/plugins/ export TUTOR_ROOT=$(pwd)
python3 -m venv venv && source venv/bin/activate
pip install -r $TUTOR_ROOT/requirements.txt
tutor config save
tutor plugins enable k8s_harmony
tutor k8s start
tutor k8s init
cd $CI_ROOT
deactivate
done
2 changes: 2 additions & 0 deletions integration-test/cluster-01/openedx-01/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
install: # Run any arbitrary commands necessary to prepare your installation
echo "Hi, running from $(pwd)"
1 change: 1 addition & 0 deletions integration-test/cluster-01/openedx-01/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
K8S_NAMESPACE: openedx-01
2 changes: 2 additions & 0 deletions integration-test/cluster-01/openedx-01/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../../../tutor-contrib-harmony-plugin
tutor[full]<19
35 changes: 35 additions & 0 deletions integration-test/cluster-01/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Disable HTTPS cert provisioning for testing with minikube
cert-manager:
enabled: true

clusterDomain: harmony.test

elasticsearch:
enabled: true

# TODO: move this to a separate PR
# Permit co-located instances for solitary minikube virtual machines.
antiAffinity: "soft"

volumeClaimTemplate:
resources:
requests:
storage: 8Gi

opensearch:
enabled: false

# Permit co-located instances for solitary minikube virtual machines.
antiAffinity: "soft"

persistence:
size: 8Gi

prometheusstack:
enabled: true

k8sdashboard:
enabled: false

openfaas:
enabled: false
34 changes: 34 additions & 0 deletions temp.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ingress nginx
# cert manager
# elastichsearch - openedx
# opensearch - openedx
# prometheusstack



# steps
# 1. Create a key for a CA
openssl genrsa -des3 -out harmony.key 2048
# 2. Generate a root certificate
openssl req -x509 -new -nodes -key harmony.key -sha256 -days 1825 -out harmony.pem
# 3. Install Certificate
sudo cp harmony.pem /usr/local/share/ca-certificates/harmony.crt
sudo update-ca-certificates
# 4. Creating CA-signed certificates for dev site
openssl genrsa -out harmony.test.key 2048
# 4.1 Create CSR:
openssl req -new -key harmony.test.key -out harmony.test.csr
# 4.2 Sign certifcate
openssl x509 -req -in harmony.test.csr -CA harmony.pem -CAkey harmony.key -CAcreateserial -out harmony.test.crt -days 825 -sha256 -extfile harmony.test.ext

# Setup certificates
sudo mkdir -p /etc/systemd/resolved.conf.d
sudo tee /etc/systemd/resolved.conf.d/minikube.conf << EOF
[Resolve]
DNS=$(minikube ip)
Domains=~harmony.test
EOF
sudo systemctl restart systemd-resolved

# Enable certificate on minikube
cp harmony.pem $HOME/.minikube/certs/harmony.pem
8 changes: 4 additions & 4 deletions values-minikube.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Disable HTTPS cert provisioning for testing with minikube
cert-manager:
enabled: false
enabled: true

clusterDomain: "example.local"
clusterDomain: harmony.test

elasticsearch:
enabled: false
enabled: true

# TODO: move this to a separate PR
# Permit co-located instances for solitary minikube virtual machines.
Expand All @@ -26,7 +26,7 @@ opensearch:
size: 8Gi

prometheusstack:
enabled: false
enabled: true

k8sdashboard:
enabled: false
Expand Down

0 comments on commit 2b5a9cc

Please sign in to comment.