Skip to content

Commit a980684

Browse files
committed
ci: test index-in-place deployment
1 parent 3349d10 commit a980684

File tree

4 files changed

+116
-4
lines changed

4 files changed

+116
-4
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: lint
1515
run: helm lint charts/*
1616

17-
test_primary_site:
17+
test_query_optimized_primary_site:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v4
@@ -30,7 +30,24 @@ jobs:
3030
env:
3131
FOXGLOVE_API_URL: ${{ vars.TEST_PRIMARY_SITE_API_URL }}
3232
FOXGLOVE_SITE_TOKEN: ${{ secrets.TEST_PRIMARY_SITE_TOKEN }}
33-
run: ./tests/test-primary-site-chart.sh ./charts/primary-site
33+
run: ./tests/test-query-optimized-primary-site-chart.sh ./charts/primary-site
34+
test_index_in_place_primary_site:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Start minio
39+
run: docker compose up minio -d
40+
working-directory: tests
41+
- name: Create minio buckets
42+
run: docker compose up createbuckets
43+
working-directory: tests
44+
- uses: medyagh/setup-minikube@v0.0.20
45+
- name: Test primary site chart install
46+
timeout-minutes: 5
47+
env:
48+
FOXGLOVE_API_URL: ${{ vars.TEST_PRIMARY_SITE_API_URL }}
49+
FOXGLOVE_SITE_TOKEN: ${{ secrets.TEST_PRIMARY_SITE_TOKEN }}
50+
run: ./tests/test-index-in-place-primary-site-chart.sh ./charts/primary-site
3451

3552
test_remote_data_loader:
3653
runs-on: ubuntu-latest

tests/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
/usr/bin/mc alias set minio http://minio:9000 root password;
2020
/usr/bin/mc mb minio/foxglove-lake/;
2121
/usr/bin/mc mb minio/foxglove-inbox/;
22+
/usr/bin/mc mb minio/foxglove-index-in-place/;
2223
/usr/bin/mc mb minio/foxglove-cache/;
2324
exit 0;
2425
"
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
3+
# Install the primary site helm chart into a fresh minikube instance and validate that all the pods were created correctly.
4+
#
5+
# The host environment needs to have the following variables set:
6+
# - FOXGLOVE_API_URL: the URL to the API version being used
7+
# - FOXGLOVE_SITE_TOKEN: a site token for a primary site created with the above API
8+
#
9+
# The host also needs to have minio with an index-in-place bucket created. It can be started with the following:
10+
# ```
11+
# docker compose up -d
12+
# ```
13+
#
14+
# When everything is ready, run the tests with `./test-index-in-place-primary-site-chart.sh ./charts/primary-site`.
15+
16+
set -euo pipefail
17+
18+
chart="${1:-""}"
19+
20+
if [ -z "$chart" ]; then
21+
echo "usage: ./test-index-in-place-primary-site-chart.sh <path to primary site chart>"
22+
exit 1
23+
fi
24+
25+
context="$(kubectl config current-context)";
26+
27+
if [ "$context" != "minikube" ]; then
28+
echo "Tests can only be run against minikube. Tried to run against: $context."
29+
exit 1
30+
fi
31+
32+
api_url="${FOXGLOVE_API_URL}"
33+
site_token="${FOXGLOVE_SITE_TOKEN}"
34+
35+
cloud_credentials_file="$(mktemp --suffix .yaml)"
36+
37+
cat >>"$cloud_credentials_file" <<EOF
38+
apiVersion: v1
39+
kind: Secret
40+
metadata:
41+
name: cloud-credentials
42+
type: Opaque
43+
stringData:
44+
S3_COMPATIBLE_ACCESS_KEY_ID: root
45+
S3_COMPATIBLE_SECRET_ACCESS_KEY: password
46+
S3_COMPATIBLE_SERVICE_REGION: default
47+
S3_COMPATIBLE_SERVICE_URL: http://host.minikube.internal:9000
48+
EOF
49+
50+
trap "rm $cloud_credentials_file" EXIT
51+
52+
set -x
53+
54+
kubectl create namespace foxglove
55+
56+
kubectl create secret generic foxglove-site-token \
57+
--from-literal="FOXGLOVE_SITE_TOKEN=$site_token" \
58+
--namespace foxglove
59+
60+
kubectl apply -f "$cloud_credentials_file" --namespace foxglove
61+
62+
helm upgrade --install foxglove-primary-site "$chart" \
63+
--namespace foxglove \
64+
--set globals.foxgloveApiUrl="$api_url" \
65+
--set globals.indexingStrategy="index-in-place" \
66+
--set globals.indexInPlace.storageProvider="s3_compatible" \
67+
--set garbageCollector.schedule="*/1 * * * *"
68+
69+
log_and_exit() {
70+
kubectl get pods -n foxglove
71+
kubectl get events -n foxglove
72+
kubectl logs -n foxglove deployment/indexer
73+
kubectl logs -n foxglove deployment/query-service
74+
kubectl logs -n foxglove deployment/site-controller
75+
exit 1
76+
}
77+
78+
wait_for_deployment() {
79+
kubectl wait --for=condition=available deployment "$1" --namespace foxglove --timeout=90s || log_and_exit
80+
}
81+
82+
wait_for_pod() {
83+
kubectl wait --for=condition=ready pod -l "app=$1" --namespace foxglove --timeout=90s || log_and_exit
84+
}
85+
86+
# Wait for each of the deployments to complete to make sure pods are created
87+
wait_for_deployment site-controller
88+
wait_for_deployment indexer
89+
wait_for_deployment query-service
90+
91+
# Wait for each of the pods to complete to make sure they didn't fail
92+
wait_for_pod site-controller
93+
wait_for_pod indexer
94+
wait_for_pod query-service

tests/test-primary-site-chart.sh renamed to tests/test-query-optimized-primary-site-chart.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
# docker compose up -d
1212
# ```
1313
#
14-
# When everything is ready, run the tests with `./test-primary-site-chart.sh ./charts/primary-site`.
14+
# When everything is ready, run the tests with `./test-query-optimized-primary-site-chart.sh ./charts/primary-site`.
1515

1616
set -euo pipefail
1717

1818
chart="${1:-""}"
1919

2020
if [ -z "$chart" ]; then
21-
echo "usage: ./test-primary-site-chart.sh <path to primary site chart>"
21+
echo "usage: ./test-query-optimized-primary-site-chart.sh <path to primary site chart>"
2222
exit 1
2323
fi
2424

0 commit comments

Comments
 (0)