This is an automated email from the ASF dual-hosted git repository.

lewismc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika-helm.git


The following commit(s) were added to refs/heads/main by this push:
     new 0f9e2cc  TIKA-4915 Helm chart CI should smoke Tika Server detect, 
metadata, and text extract (#43)
0f9e2cc is described below

commit 0f9e2ccb11f3fe61604c458ae7339e7acb93a312
Author: Lewis John McGibbney <[email protected]>
AuthorDate: Sun Sep 20 11:53:37 2026 -0700

    TIKA-4915 Helm chart CI should smoke Tika Server detect, metadata, and text 
extract (#43)
---
 .github/ci/tika-endpoint-check-job.yaml   | 34 -----------
 .github/ci/tika-http-root-check-job.yaml  |  2 +-
 .github/ci/tika-ingest-check-job.yaml     | 93 +++++++++++++++++++++++++++++++
 .github/workflows/install-test-chart.yaml | 13 +++--
 .github/workflows/lint-test.yaml          | 14 +----
 templates/tests/test-connection.yaml      | 63 +++++++++++++++++++--
 6 files changed, 165 insertions(+), 54 deletions(-)

diff --git a/.github/ci/tika-endpoint-check-job.yaml 
b/.github/ci/tika-endpoint-check-job.yaml
deleted file mode 100644
index 1b0b3ef..0000000
--- a/.github/ci/tika-endpoint-check-job.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Used by .github/workflows/install-test-chart.yaml (post-install /tika 
endpoint check).
-apiVersion: batch/v1
-kind: Job
-metadata:
-  name: tika-endpoint-check
-spec:
-  backoffLimit: 2
-  template:
-    spec:
-      restartPolicy: Never
-      containers:
-        - name: curl
-          image: curlimages/curl:latest
-          command: ["sh", "-c"]
-          args:
-            - |
-              # GET /tika returns 200 (OK) or 405 (Method Not Allowed) when 
endpoint is up
-              code=$(curl -s -o /dev/null -w "%{http_code}" 
http://tika:9998/tika)
-              case "$code" in 200|405) exit 0 ;; *) echo "Unexpected /tika 
status: $code"; exit 1 ;; esac
diff --git a/.github/ci/tika-http-root-check-job.yaml 
b/.github/ci/tika-http-root-check-job.yaml
index 248b7bf..94128a7 100644
--- a/.github/ci/tika-http-root-check-job.yaml
+++ b/.github/ci/tika-http-root-check-job.yaml
@@ -25,7 +25,7 @@ spec:
       restartPolicy: Never
       containers:
         - name: curl
-          image: curlimages/curl:latest
+          image: curlimages/curl:8.16.0
           command: ["sh", "-c"]
           args:
             - |
diff --git a/.github/ci/tika-ingest-check-job.yaml 
b/.github/ci/tika-ingest-check-job.yaml
new file mode 100644
index 0000000..46c8c2d
--- /dev/null
+++ b/.github/ci/tika-ingest-check-job.yaml
@@ -0,0 +1,93 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Used by .github/workflows/install-test-chart.yaml.
+# Mounts ConfigMap tika-smoke-schema (key values.schema.json).
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: tika-smoke-check
+spec:
+  backoffLimit: 2
+  template:
+    spec:
+      restartPolicy: Never
+      containers:
+        - name: curl
+          image: curlimages/curl:8.16.0
+          command: ["sh", "-c"]
+          args:
+            - |
+              set -eu
+              SAMPLE=/sample/values.schema.json
+              BASE=http://tika:9998
+              test -s "$SAMPLE"
+
+              echo "=== GET /version ==="
+              ver=$(curl -sS -f "$BASE/version")
+              echo "$ver"
+              echo "$ver" | grep -q "Apache Tika" || {
+                echo "GET /version did not contain Apache Tika"
+                exit 1
+              }
+
+              echo "=== PUT /detect ==="
+              mime=$(curl -sS -f -T "$SAMPLE" \
+                -H "Content-Disposition: attachment; 
filename=values.schema.json" \
+                "$BASE/detect" | tr -d '\r')
+              echo "$mime"
+              echo "$mime" | grep -qi "json" || {
+                echo "Expected MIME containing json, got: $mime"
+                exit 1
+              }
+
+              echo "=== PUT /meta ==="
+              meta=$(curl -sS -f -T "$SAMPLE" \
+                -H "Accept: application/json" \
+                -H "Content-Disposition: attachment; 
filename=values.schema.json" \
+                "$BASE/meta")
+              echo "$meta"
+              echo "$meta" | grep -qi "Content-Type" || {
+                echo "Metadata missing Content-Type"
+                exit 1
+              }
+              echo "$meta" | grep -qi "json" || {
+                echo "Metadata Content-Type missing json"
+                exit 1
+              }
+
+              echo "=== PUT /tika ==="
+              text=$(curl -sS -f -T "$SAMPLE" \
+                -H "Accept: text/plain" \
+                -H "Content-Disposition: attachment; 
filename=values.schema.json" \
+                "$BASE/tika")
+              echo "$text" | head -c 500
+              echo
+              echo "$text" | grep -F '$schema' || {
+                echo "Extracted text did not contain \$schema"
+                exit 1
+              }
+              echo "$text" | grep -q "Enable autoscaling for Tika pods" || {
+                echo "Extracted text did not contain Enable autoscaling for 
Tika pods"
+                exit 1
+              }
+          volumeMounts:
+            - name: sample
+              mountPath: /sample
+              readOnly: true
+      volumes:
+        - name: sample
+          configMap:
+            name: tika-smoke-schema
diff --git a/.github/workflows/install-test-chart.yaml 
b/.github/workflows/install-test-chart.yaml
index 28ef7a2..b8597b6 100644
--- a/.github/workflows/install-test-chart.yaml
+++ b/.github/workflows/install-test-chart.yaml
@@ -94,8 +94,13 @@ jobs:
           kubectl wait --for=condition=complete job/tika-http-root-check -n 
tika-test --timeout=120s
           kubectl delete job tika-http-root-check -n tika-test 
--ignore-not-found
 
-      - name: Verify Tika /tika endpoint
+      - name: Smoke Tika version, detect, metadata, and text
         run: |
-          kubectl apply -f .github/ci/tika-endpoint-check-job.yaml -n tika-test
-          kubectl wait --for=condition=complete job/tika-endpoint-check -n 
tika-test --timeout=120s
-          kubectl delete job tika-endpoint-check -n tika-test 
--ignore-not-found
+          kubectl create configmap tika-smoke-schema \
+            --from-file=values.schema.json=values.schema.json \
+            -n tika-test --dry-run=client -o yaml | kubectl apply -f -
+          kubectl apply -f .github/ci/tika-ingest-check-job.yaml -n tika-test
+          kubectl wait --for=condition=complete job/tika-smoke-check -n 
tika-test --timeout=120s
+          kubectl logs job/tika-smoke-check -n tika-test
+          kubectl delete job tika-smoke-check -n tika-test --ignore-not-found
+          kubectl delete configmap tika-smoke-schema -n tika-test 
--ignore-not-found
diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml
index 0aaacb8..705d8ca 100644
--- a/.github/workflows/lint-test.yaml
+++ b/.github/workflows/lint-test.yaml
@@ -25,8 +25,6 @@ on:
 jobs:
   lint-test:
     runs-on: ubuntu-latest
-    outputs:
-      changed: ${{ steps.list-changed.outputs.changed }}
     env:
       CT_VERSION: '3.12.0'
     steps:
@@ -58,14 +56,6 @@ jobs:
           pipx install yamale
           echo "$HOME/.local/bin" >> "$GITHUB_PATH"
         shell: bash
-      - name: Run chart-testing (list-changed)
-        id: list-changed
-        run: |
-          changed=$(ct list-changed --target-branch ${{ 
github.event.repository.default_branch }})
-          if [[ -n "$changed" ]]; then
-            echo "changed=true" >> "$GITHUB_OUTPUT"
-          fi
-        shell: bash
       - name: Run chart-testing (lint)
         run: ct lint --target-branch ${{ 
github.event.repository.default_branch }} --charts .
         shell: bash
@@ -78,9 +68,11 @@ jobs:
         run: helm unittest .
         shell: bash
 
+  # The chart lives at the repository root, so ct list-changed cannot detect 
it:
+  # it skips changed paths with fewer than two elements. Rather than gate on a
+  # detection that silently skips, always install and smoke the chart.
   install-test:
     needs: lint-test
-    if: needs.lint-test.outputs.changed == 'true'
     uses: ./.github/workflows/install-test-chart.yaml
     with:
       ref: ${{ github.sha }}
diff --git a/templates/tests/test-connection.yaml 
b/templates/tests/test-connection.yaml
index a2a8e9f..0fa8c79 100644
--- a/templates/tests/test-connection.yaml
+++ b/templates/tests/test-connection.yaml
@@ -15,6 +15,22 @@
 # specific language governing permissions and limitations
 # under the License.
 
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: "{{ include "tika-helm.fullname" . }}-test-values"
+  namespace: {{ include "tika-helm.namespace" . }}
+  labels:
+    {{- include "tika-helm.labels" . | nindent 4 }}
+  annotations:
+    "helm.sh/hook": test
+    "helm.sh/hook-weight": "-1"
+data:
+  # .Files cannot read values.schema.json, so ingest the release values, which
+  # are an equivalent JSON document, rather than ship a sample file.
+  values.json: |
+{{ .Values | toPrettyJson | indent 4 }}
 ---
 apiVersion: v1
 kind: Pod
@@ -25,10 +41,49 @@ metadata:
     {{- include "tika-helm.labels" . | nindent 4 }}
   annotations:
     "helm.sh/hook": test
+    "helm.sh/hook-weight": "0"
 spec:
   containers:
-    - name: wget
-      image: busybox
-      command: ['wget']
-      args: ['{{ include "tika-helm.fullname" . }}:{{ .Values.service.port }}']
+    - name: ingest
+      image: curlimages/curl:8.16.0
+      command: ["sh", "-c"]
+      args:
+        - |
+          set -eu
+          SAMPLE=/sample/values.json
+          BASE=http://{{ include "tika-helm.fullname" . }}:{{ 
.Values.service.port }}
+          test -s "$SAMPLE"
+
+          ver=$(curl -sS -f "$BASE/version")
+          echo "$ver"
+          echo "$ver" | grep -q "Apache Tika"
+
+          mime=$(curl -sS -f -T "$SAMPLE" \
+            -H "Content-Disposition: attachment; filename=values.json" \
+            "$BASE/detect" | tr -d '\r')
+          echo "$mime"
+          echo "$mime" | grep -qi "json"
+
+          meta=$(curl -sS -f -T "$SAMPLE" \
+            -H "Accept: application/json" \
+            -H "Content-Disposition: attachment; filename=values.json" \
+            "$BASE/meta")
+          echo "$meta"
+          echo "$meta" | grep -qi "Content-Type"
+          echo "$meta" | grep -qi "json"
+
+          text=$(curl -sS -f -T "$SAMPLE" \
+            -H "Accept: text/plain" \
+            -H "Content-Disposition: attachment; filename=values.json" \
+            "$BASE/tika")
+          echo "$text" | grep -q "readinessProbe"
+          echo "$text" | grep -q "securityContext"
+      volumeMounts:
+        - name: sample
+          mountPath: /sample
+          readOnly: true
+  volumes:
+    - name: sample
+      configMap:
+        name: "{{ include "tika-helm.fullname" . }}-test-values"
   restartPolicy: Never

Reply via email to