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 f5dc3f7 commit 28d5515
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 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: 1 addition & 1 deletion charts/gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ type: application
# Trino Gateway Helm chart version. Should be appVersion with .0.0 appended.
version: "12.0.0"
# Trino Gateway version
appVersion: "12"
appVersion: "11"
2 changes: 1 addition & 1 deletion charts/gateway/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# trino-gateway

![Version: 12.0.0](https://img.shields.io/badge/Version-12.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 12](https://img.shields.io/badge/AppVersion-12-informational?style=flat-square)
![Version: 12.0.0](https://img.shields.io/badge/Version-12.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 11](https://img.shields.io/badge/AppVersion-11-informational?style=flat-square)

A Helm chart for Trino Gateway

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 28d5515

Please sign in to comment.