|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | +# |
| 20 | + |
| 21 | +set -e |
| 22 | + |
| 23 | +E2E_DIR=$(dirname "$0") |
| 24 | +BASE_DIR=$(cd "${E2E_DIR}"/../../../../..;pwd) |
| 25 | +PULSAR_NAMESPACE=${PULSAR_NAMESPACE:-"default"} |
| 26 | +PULSAR_RELEASE_NAME=${PULSAR_RELEASE_NAME:-"sn-platform"} |
| 27 | +E2E_KUBECONFIG=${E2E_KUBECONFIG:-"/tmp/e2e-k8s.config"} |
| 28 | +MANIFESTS_FILE="${BASE_DIR}"/.ci/tests/integration-oauth2/cases/java-download-function-with-package-service/manifests.yaml |
| 29 | + |
| 30 | +source "${BASE_DIR}"/.ci/helm.sh |
| 31 | + |
| 32 | +FUNCTION_NAME=function-download-sample-package-service |
| 33 | +STS_NAME=${FUNCTION_NAME}-function |
| 34 | + |
| 35 | +if [ ! "$KUBECONFIG" ]; then |
| 36 | + export KUBECONFIG=${E2E_KUBECONFIG} |
| 37 | +fi |
| 38 | + |
| 39 | +kubectl apply -f "${MANIFESTS_FILE}" > /dev/null 2>&1 |
| 40 | + |
| 41 | +verify_fm_result=$(ci::verify_function_mesh ${FUNCTION_NAME} 2>&1) |
| 42 | +if [ $? -ne 0 ]; then |
| 43 | + echo "$verify_fm_result" |
| 44 | + kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 45 | + exit 1 |
| 46 | +fi |
| 47 | + |
| 48 | +sts_yaml=$(kubectl get statefulset "${STS_NAME}" -o yaml 2>&1) |
| 49 | +echo "${sts_yaml}" | grep "prefix: PACKAGE_" > /dev/null 2>&1 || { |
| 50 | + echo "packageService env prefix is not injected" |
| 51 | + kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 52 | + exit 1 |
| 53 | +} |
| 54 | +echo "${sts_yaml}" | grep "name: test-pulsar-package-service" > /dev/null 2>&1 || { |
| 55 | + echo "packageService configmap is not injected" |
| 56 | + kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 57 | + exit 1 |
| 58 | +} |
| 59 | +echo "${sts_yaml}" | grep "/etc/oauth2-package-service" > /dev/null 2>&1 || { |
| 60 | + echo "packageService oauth2 volume mount is not injected" |
| 61 | + kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 62 | + exit 1 |
| 63 | +} |
| 64 | + |
| 65 | +verify_java_result=$(NAMESPACE=${PULSAR_NAMESPACE} CLUSTER=${PULSAR_RELEASE_NAME} ci::verify_exclamation_function_with_auth \ |
| 66 | + persistent://public/default/input-download-java-package-service-topic \ |
| 67 | + persistent://public/default/output-download-java-package-service-topic \ |
| 68 | + test-message test-message! 10 2>&1) |
| 69 | +if [ $? -ne 0 ]; then |
| 70 | + echo "$verify_java_result" |
| 71 | + kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 72 | + exit 1 |
| 73 | +fi |
| 74 | + |
| 75 | +verify_log_topic=$(ci::verify_log_topic_with_auth persistent://public/default/logging-function-logs-package-service "it is not a NAR file" 10 2>&1) |
| 76 | +if [ $? -ne 0 ]; then |
| 77 | + echo "$verify_log_topic" |
| 78 | + kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 79 | + exit 1 |
| 80 | +fi |
| 81 | + |
| 82 | +kubectl delete -f "${MANIFESTS_FILE}" > /dev/null 2>&1 || true |
| 83 | +echo "e2e-test: ok" | yq eval - |
0 commit comments