-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Spazzy <[email protected]>
- Loading branch information
Showing
28 changed files
with
684 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
DB_VERSION=v21.1.9 | ||
PORT=5432 | ||
DATABASE=chatroach | ||
|
||
dev: create-kind-cluster setup-dev-secret setup-kind-registry bootstrap-fly | ||
|
||
start-testrunner: | ||
@kubectl apply -f testing/facebot.yaml | ||
@kubectl wait --for=condition=available deployment/facebot --timeout 5m | ||
@kubectl delete job testrunner || true | ||
@envsubst < testing/testrunner.yaml | kubectl apply -f - | ||
|
||
.PHONY: check-test-status | ||
check-test-status: | ||
$(eval SUCCESS=$(shell kubectl get job testrunner -o jsonpath='{.status.succeeded}')) | ||
@if [ "$(SUCCESS)" != "1" ]; then\ | ||
exit 1; \ | ||
fi | ||
@echo "Test Succesful" | ||
|
||
.PHONY: integration-tests | ||
integration-tests: create-integration-secret bootstrap-fly start-testrunner | ||
@kubectl wait --for=condition=complete job/testrunner --timeout 10m | ||
@kubectl logs -l app=testrunner --tail -1 | ||
$(MAKE) check-test-status | ||
|
||
create-kind-cluster: | ||
@kind create cluster --config dev/kind-cluster.yaml | ||
|
||
create-integration-secret: | ||
@kubectl create secret generic bot-envs --from-env-file=./testing/.test-env || true | ||
|
||
create-dev-secret: | ||
@kubectl create secret generic bot-envs --from-env-file=./dev/.env || true | ||
|
||
bootstrap-fly: | ||
@bash ./scripts/bootstrap-fly.sh | ||
|
||
setup-kind-registry: | ||
@bash ./dev/kind-with-registry.sh | ||
|
||
test-db: | ||
@docker stop vlab-cockroach && docker rm vlab-cockroach | ||
@docker run --name vlab-cockroach -d \ | ||
-p $(PORT):26257 \ | ||
cockroachdb/cockroach:$(DB_VERSION) start-single-node --insecure | ||
@cat ./sql/* | docker run -i \ | ||
--net=host \ | ||
--rm cockroachdb/cockroach:$(DB_VERSION) \ | ||
sql --insecure --host localhost --port $(PORT) --database chatroach | ||
@echo "set sql_safe_updates = false;" | docker run -i \ | ||
--net=host \ | ||
--rm cockroachdb/cockroach:$(DB_VERSION) \ | ||
sql --insecure --host localhost --port $(PORT) --database chatroach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
containerdConfigPatches: | ||
- |- | ||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"] | ||
endpoint = ["http://kind-registry:5000"] | ||
# We should have a kind cluster that has some workers | ||
# to speed up deployment | ||
nodes: | ||
- role: control-plane | ||
- role: worker | ||
- role: worker | ||
- role: worker | ||
- role: worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
###################### | ||
# add third party charts | ||
###################### | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm repo add cockroachdb https://charts.cockroachdb.com/ | ||
helm repo update | ||
|
||
###################### | ||
# install db | ||
###################### | ||
helm upgrade --install db cockroachdb/cockroachdb \ | ||
--values values/integrations/cdb.yaml \ | ||
--timeout 10m \ | ||
--wait | ||
|
||
###################### | ||
# create database | ||
###################### | ||
cat ./sql/* > tmp.sql | ||
|
||
# Note we skip this if it fails as | ||
# currently migrations are not idempotent | ||
cat tmp.sql | kubectl run -i \ | ||
--rm cockroach-client \ | ||
--image=cockroachdb/cockroach:v2.1.4 \ | ||
--restart=Never \ | ||
--command -- ./cockroach sql --insecure --host db-cockroachdb-public || true | ||
rm -f tmp.sql | ||
|
||
###################### | ||
# install kafka | ||
###################### | ||
helm upgrade --install kafka bitnami/kafka \ | ||
--values values/integrations/kafka.yaml \ | ||
--timeout 10m0s \ | ||
--wait | ||
|
||
###################### | ||
# install fly | ||
###################### | ||
helm upgrade --install \ | ||
fly vlab \ | ||
-f values/integrations/fly.yaml \ | ||
--timeout 10m0s \ | ||
--wait | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
kubectl scale statefulset fly-cockroachdb --replicas=0 | ||
kubectl delete pvc datadir-fly-cockroachdb-0 | ||
kubectl scale statefulset fly-cockroachdb --replicas=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# This is just a file to run each sql migration individual in order to pick up | ||
# which migration failed | ||
set -e | ||
|
||
FILES="sql/*.sql" | ||
for f in $FILES | ||
do | ||
echo "Processing $f file..." | ||
# take action on each file. $f store current file name | ||
cat "$f" | kubectl run -i \ | ||
--rm cockroach-client \ | ||
--image=cockroachdb/cockroach:v21.1.9 \ | ||
--restart=Never \ | ||
--command -- ./cockroach sql --insecure --host fly-cockroachdb-public | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.