Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run smoke test

on: [push]


jobs:
smoke_test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install minikube helmfile and plugins
run : |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
install minikube-linux-amd64 /usr/local/bin/minikube
minikube version
HELMFILE_VERSION=0.153.1
curl -LO https://github.com/helmfile/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz
tar -xzf helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz -C /usr/local/bin/
helm plugin install https://github.com/databus23/helm-diff

- name: setup
run : |
cd local-kubernetes
make kube
make install
kubectl get pod -n rococo
kubectl wait --for=condition=Ready pods --all -n rococo --timeout=900s
kubectl get pod -n rococo

- name: Tests
run : |
pwd
(cd local-kubernetes && make web-ci)
pwd
./tests/smoke_test.sh

- uses: actions/upload-artifact@v3
with:
name: web
path: output

2 changes: 2 additions & 0 deletions app/routers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
templates = Jinja2Templates(directory='app/templates')
network = get_network()


@router.get("/", response_class=HTMLResponse, include_in_schema=False)
@router.get("/index.html", response_class=HTMLResponse, include_in_schema=False)
async def homepage(request: Request):
return templates.TemplateResponse('index.html', {'request': request, 'network': network})

Expand Down
15 changes: 9 additions & 6 deletions local-kubernetes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Validator-manager Quick Deploy Makefile for Development and Testing
# ============================================================================================

KUBERNETES_CONTEXT = rancher-desktop # minikube or rancher-desktop
KUBERNETES_CONTEXT = minikube # minikube or rancher-desktop
# rococo or wococo (don't put space at the end of the variable it will be used as is)
CHAIN_NAMESPACE = rococo

Expand All @@ -18,7 +18,7 @@ kube: kube_${KUBERNETES_CONTEXT}
kube_minikube:
@minikube start \
--addons ingress --addons metrics-server --addons registry --driver docker \
--kubernetes-version=1.23.3 --memory=8g --cpus=4
--kubernetes-version=1.23.3 --memory=6g --cpus=2

kube_minikube-podman:
@minikube start \
Expand Down Expand Up @@ -80,20 +80,23 @@ web-tasks:
@xdg-open 'http://localhost:8081/tasks'
@kubectl --context ${KUBERNETES_CONTEXT} port-forward service/testnet-manager-task-scheduler 8081:80 -n ${CHAIN_NAMESPACE}

web-ci:
kubectl --context ${KUBERNETES_CONTEXT} port-forward service/testnet-manager 8080:80 -n ${CHAIN_NAMESPACE} &
timeout 30 sh -c 'until nc -z 127.0.0.1 8080; do sleep 1; echo -n .; done'

# ============================================================================================

apply: check
@helmfile --file ./charts/helmfile-${CHAIN_NAMESPACE}.yaml apply
@kubectl --context ${KUBERNETES_CONTEXT} delete pod -l app.kubernetes.io/name=testnet-manager -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} delete pod -l app.kubernetes.io/name=testnet-manager-task-scheduler -n ${CHAIN_NAMESPACE} # force recreate testnet-manager pod

install: build setup apply
install: setup build apply

# ============================================================================================

reload: build
@kubectl --context ${KUBERNETES_CONTEXT} delete pod -l app.kubernetes.io/name=testnet-manager -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} delete pod -l app.kubernetes.io/name=testnet-manager-task-scheduler -n ${CHAIN_NAMESPACE}
@kubectl --context ${KUBERNETES_CONTEXT} delete pod -l app.kubernetes.io/name=testnet-manager-task-scheduler -n ${CHAIN_NAMESPACE} # force recreate testnet-manager pod
@make log &
@make web

log:
Expand Down
28 changes: 28 additions & 0 deletions tests/smoke_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash -e

# Usage:
# kubectl --context minikube port-forward service/testnet-manager 8080:80 -n rococo
# ./smoke_test.sh

ROUTE='index.html
nodes
nodes/localrococo-bootnode-0
nodes/localrococo-moonbase-alice-node-0
nodes/localrococo-shell-collator-node-0
nodes/localrococo-statemint-alice-node-0
validators
parachains
parachains/1000/runtime
parachains/1001/runtime
collators/1000
collators/1001
runtime
'

for path in $ROUTE;
do
echo "/$path"
curl --fail --silent --show-error http://localhost:8080/$path --create-dirs --remote-name --output-dir ./output
done

find ./output -type f -not -name "*.html" -exec mv {} {}.html \;