Skip to content

Commit

Permalink
Test the Trino Gateway chart
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick committed Nov 17, 2024
1 parent cd29127 commit 0e024e7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- { label: 435, args: '-a "--set image.tag=435"' }
# skip cleanup to test deploying multiple releases in a single namespace
- { label: overrides, args: '-s -t default,overrides' }
- { label: gateway, args: '-t gateway' }
steps:
- uses: actions/checkout@v4
- name: Set up Helm
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ helm template my-trino trino/trino --namespace <YOUR_NAMESPACE>

## Documentation

You can find documentation about the chart [here](./charts/trino/README.md).
You can find documentation about the charts:
* [Trino](./charts/trino/README.md).
* [Trino Gateway](./charts/gateway/README.md).

## Development

Expand Down
2 changes: 2 additions & 0 deletions charts/gateway/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: "{{ include "trino-gateway.fullname" . }}-test-connection"
labels:
{{- include "trino-gateway.labels" . | nindent 4 }}
app.kubernetes.io/component: test
test: connection
annotations:
"helm.sh/hook": test
spec:
Expand Down
19 changes: 17 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ declare -A testCases=(
[access_control_properties_values]="--values test-access-control-properties-values.yaml"
[exchange_manager_values]="--values test-exchange-manager-values.yaml"
[graceful_shutdown]="--values test-graceful-shutdown-values.yaml"
[gateway]=""
)

declare -A testCaseCharts=(
[default]="charts/trino"
[single_node]="charts/trino"
[complete_values]="charts/trino"
[overrides]="charts/trino"
[access_control_properties_values]="charts/trino"
[exchange_manager_values]="charts/trino"
[graceful_shutdown]="charts/trino"
[gateway]="charts/gateway"
)

function join_by {
Expand All @@ -22,7 +34,10 @@ function join_by {
# default to randomly generated namespace, same as chart-testing would do, but we need to load secrets into the same namespace
NAMESPACE=trino-$(LC_ALL=C tr -dc 'a-z0-9' </dev/urandom | head -c 6 || true)
HELM_EXTRA_SET_ARGS=
CT_ARGS=(--charts=charts/trino --skip-clean-up --helm-extra-args="--timeout 2m")
CT_ARGS=(
--skip-clean-up
--helm-extra-args="--timeout 2m"
)
CLEANUP_NAMESPACE=true
TEST_NAMES=(default single_node complete_values access_control_properties_values exchange_manager_values graceful_shutdown)

Expand Down Expand Up @@ -107,7 +122,7 @@ for test_name in "${TEST_NAMES[@]}"; do
echo 1>&2 ""
echo 1>&2 "🧪 Running test $test_name"
echo 1>&2 ""
if ! time ct install "${CT_ARGS[@]}" --helm-extra-set-args "$HELM_EXTRA_SET_ARGS ${testCases[$test_name]}"; then
if ! time ct install "${CT_ARGS[@]}" --charts="${testCaseCharts[$test_name]}" --helm-extra-set-args "$HELM_EXTRA_SET_ARGS ${testCases[$test_name]}"; then
echo 1>&2 "❌ Test $test_name failed"
echo 1>&2 "Test logs:"
kubectl --namespace "$NAMESPACE" logs --tail=-1 --selector app.kubernetes.io/component=test --all-containers=true
Expand Down

0 comments on commit 0e024e7

Please sign in to comment.