From c40bda295ffaa7b08f1fbc42b98e07b10205d47e Mon Sep 17 00:00:00 2001 From: "Mikael H. Moeller" Date: Wed, 8 Nov 2023 21:45:04 +0000 Subject: [PATCH] standardize the use of a `prestart.sh` script inside test_collections --- prestart.sh | 9 ++++++-- test_collections/sdk_tests/prestart.sh | 23 +++++++++++++++++++ .../fetch_sdk_tests_and_runner.sh | 0 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 test_collections/sdk_tests/prestart.sh rename test_collections/sdk_tests/{ => scripts}/fetch_sdk_tests_and_runner.sh (100%) diff --git a/prestart.sh b/prestart.sh index accd9d67..d2cb7021 100755 --- a/prestart.sh +++ b/prestart.sh @@ -24,5 +24,10 @@ alembic upgrade head # Create initial data in DB python ./app/initial_data.py -# Update SDK Tests (YAML and Python Tests) -./test_collections/sdk_tests/fetch_sdk_tests_and_runner.sh \ No newline at end of file +# Run Prestart scripts in test collections +for dir in ./test_collections/* +do + prestart=$dir/prestart.sh + # Only run prestart.sh if present/ + [ -x $prestart ] && $prestart +done diff --git a/test_collections/sdk_tests/prestart.sh b/test_collections/sdk_tests/prestart.sh new file mode 100755 index 00000000..e0311324 --- /dev/null +++ b/test_collections/sdk_tests/prestart.sh @@ -0,0 +1,23 @@ +#! /usr/bin/env bash + + # + # Copyright (c) 2023 Project CHIP Authors + # + # Licensed 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. + + # Paths +SDK_TESTS_DIR=$(dirname "$0") +cd $SDK_TESTS_DIR + +# Fetch code from SDK +./scripts/fetch_sdk_tests_and_runner.sh \ No newline at end of file diff --git a/test_collections/sdk_tests/fetch_sdk_tests_and_runner.sh b/test_collections/sdk_tests/scripts/fetch_sdk_tests_and_runner.sh similarity index 100% rename from test_collections/sdk_tests/fetch_sdk_tests_and_runner.sh rename to test_collections/sdk_tests/scripts/fetch_sdk_tests_and_runner.sh