This is an automated email from the ASF dual-hosted git repository. hgruszecki pushed a commit to branch 1889-test-examples in repository https://gitbox.apache.org/repos/asf/iggy.git
commit ab68151cb77c40e90c34a6f041256c4cacb23044 Author: Huan-Cheng Chang <[email protected]> AuthorDate: Sun Sep 28 10:39:32 2025 +0100 fix --- foreign/python/scripts/test_examples.sh | 76 ------------------------------ scripts/run-python-examples-from-readme.sh | 3 +- 2 files changed, 1 insertion(+), 78 deletions(-) diff --git a/foreign/python/scripts/test_examples.sh b/foreign/python/scripts/test_examples.sh deleted file mode 100755 index 926fa08e6..000000000 --- a/foreign/python/scripts/test_examples.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# 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. - -# Must be executed from the root of the repo. - -echo "🚀 Running example scripts..." - -cd examples/python || exit 1 - -EXEC_TIMEOUT_SEC=5 - -for example in ./*; do - # Skip readme - if [ -f "./$example" ]; then - continue - fi - - # Run producer - producer_path="./$example/producer.py" - if [ ! -f "$producer_path" ]; then - echo "⚠️ producer.py not found in example '${example}'" - TEST_EXIT_CODE=1 - continue - fi - - # Note: Examples might run indefinitely, so we'll just test they start correctly - # Assuming that the script does not require arguments or has default arguments - timeout $EXEC_TIMEOUT_SEC python3 "$producer_path" - EXIT_CODE=$? - - # Code 124: default exit code produced by timeout when the task runs out of time - if [[ $EXIT_CODE = 0 || $EXIT_CODE = 124 ]]; then - echo "✅ Producer in example '$example' started successfully" - else - echo "❌ Producer in example '$example' failed to start" - TEST_EXIT_CODE=1 - continue - fi - - # Run consumer - consumer_path="./$example/consumer.py" - if [ ! -f "$consumer_path" ]; then - echo "⚠️ consumer.py not found in example '$example'" - TEST_EXIT_CODE=1 - continue - fi - - # Note: Examples might run indefinitely, so we'll just test they start correctly - # Assuming that the script does not require arguments or has default arguments. - timeout $EXEC_TIMEOUT_SEC python3 "$consumer_path" - EXIT_CODE=$? - - if [[ $EXIT_CODE = 0 || $EXIT_CODE = 124 ]]; then - echo "✅ Consumer in example '$example' started successfully" - else - echo "❌ Consumer in example '$example' failed to start" - TEST_EXIT_CODE=1 - fi -done - -exit "$TEST_EXIT_CODE" diff --git a/scripts/run-python-examples-from-readme.sh b/scripts/run-python-examples-from-readme.sh index e5de27e2b..84cc1cf6c 100755 --- a/scripts/run-python-examples-from-readme.sh +++ b/scripts/run-python-examples-from-readme.sh @@ -97,7 +97,6 @@ echo "🚀 Running python example scripts..." cd examples/python || exit 1 -EXEC_TIMEOUT_SEC=10 exit_code=0 # Execute all example commands from examples/python/README.md and check if they pass or fail @@ -115,7 +114,7 @@ if [ -f "README.md" ]; then echo "" set +e - timeout $EXEC_TIMEOUT_SEC eval "${command}" + eval "timeout 10 ${command}" test_exit_code=0 set -e
