From 5c220dff3f950354c76e7d8be465c8db3733b1ea Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Mon, 6 May 2024 14:43:08 +0800 Subject: [PATCH] fix ci --- .ci/helm.sh | 19 +++++++++++++------ controllers/spec/common.go | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.ci/helm.sh b/.ci/helm.sh index 89e2bf8b..4acd788e 100644 --- a/.ci/helm.sh +++ b/.ci/helm.sh @@ -382,7 +382,8 @@ function ci::verify_exclamation_function() { timesleep=$5 kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" sleep "$timesleep" - MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest "${outputtopic}") + sub=`cat /dev/urandom | tr -dc 'a-z' | head -c 8` + MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "${sub}" --subscription-position Earliest "${outputtopic}") echo "$MESSAGE" if [[ "$MESSAGE" == *"$outputmessage"* ]]; then return 0 @@ -399,7 +400,8 @@ function ci::verify_exclamation_function_with_auth() { command="kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- sh -c 'bin/pulsar-client --auth-plugin \$brokerClientAuthenticationPlugin --auth-params \$brokerClientAuthenticationParameters produce -m \"${inputmessage}\" -n 1 \"${inputtopic}\"'" sh -c "$command" sleep "$timesleep" - consumeCommand="kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- sh -c 'bin/pulsar-client --auth-plugin \$brokerClientAuthenticationPlugin --auth-params \$brokerClientAuthenticationParameters consume -n 1 -s "sub" --subscription-position Earliest \"${outputtopic}\"'" + sub=`cat /dev/urandom | tr -dc 'a-z' | head -c 8` + consumeCommand="kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- sh -c 'bin/pulsar-client --auth-plugin \$brokerClientAuthenticationPlugin --auth-params \$brokerClientAuthenticationParameters consume -n 1 -s \"${sub}\" --subscription-position Earliest \"${outputtopic}\"'" MESSAGE=$(sh -c "$consumeCommand") echo "$MESSAGE" if [[ "$MESSAGE" == *"$outputmessage"* ]]; then @@ -416,7 +418,8 @@ function ci::verify_wordcount_function() { timesleep=$5 kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -m "${inputmessage}" -n 1 "${inputtopic}" sleep "$timesleep" - MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 3 -s "sub" --subscription-position Earliest "${outputtopic}") + sub=`cat /dev/urandom | tr -dc 'a-z' | head -c 8` + MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 3 -s "${sub}" --subscription-position Earliest "${outputtopic}") echo "$MESSAGE" if [[ "$MESSAGE" == *"$outputmessage"* ]]; then return 0 @@ -492,6 +495,7 @@ function ci::verify_mongodb_source() { if [ $? -eq 0 ]; then return 0 fi + kubectl logs --tail=-1 -l compute.functionmesh.io/name=source-sample return 1 } @@ -517,7 +521,8 @@ function ci::verify_function_with_encryption() { kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client produce -ekn "myapp1" -ekv "data:application/x-pem-file;base64,${correct_pubkey}" -m "${inputmessage}" -n 1 "${inputtopic}" sleep "$timesleep" - MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest "${outputtopic}") + sub=`cat /dev/urandom | tr -dc 'a-z' | head -c 8` + MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "${sub}" --subscription-position Earliest "${outputtopic}") echo "$MESSAGE" if [[ "$MESSAGE" == *"$outputmessage"* ]]; then return 0 @@ -606,7 +611,8 @@ function ci::verify_log_topic() { timesleep=$3 sleep "$timesleep" - MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "sub" --subscription-position Earliest "${logTopic}") + sub=`cat /dev/urandom | tr -dc 'a-z' | head -c 8` + MESSAGE=$(kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- bin/pulsar-client consume -n 1 -s "${sub}" --subscription-position Earliest "${logTopic}") echo "$MESSAGE" if [[ "$MESSAGE" == *"$message"* ]]; then return 0 @@ -621,7 +627,8 @@ function ci::verify_log_topic_with_auth() { timesleep=$3 sleep "$timesleep" - consumeCommand="kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- sh -c 'bin/pulsar-client --auth-plugin \$brokerClientAuthenticationPlugin --auth-params \$brokerClientAuthenticationParameters consume -n 1 -s "sub" --subscription-position Earliest \"${logTopic}\"'" + sub=`cat /dev/urandom | tr -dc 'a-z' | head -c 8` + consumeCommand="kubectl exec -n ${NAMESPACE} ${CLUSTER}-pulsar-broker-0 -- sh -c 'bin/pulsar-client --auth-plugin \$brokerClientAuthenticationPlugin --auth-params \$brokerClientAuthenticationParameters consume -n 1 -s \"${sub}\" --subscription-position Earliest \"${logTopic}\"'" MESSAGE=$(sh -c "$consumeCommand") echo "$MESSAGE" if [[ "$MESSAGE" == *"$message"* ]]; then diff --git a/controllers/spec/common.go b/controllers/spec/common.go index 87ae2dd2..852079f6 100644 --- a/controllers/spec/common.go +++ b/controllers/spec/common.go @@ -20,6 +20,7 @@ package spec import ( "bytes" "context" + // used for template _ "embed" "encoding/json"