Skip to content

Commit

Permalink
Fixes #71: Parallel Tests Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeManSu committed Jan 16, 2025
1 parent 4db1313 commit 50aa680
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -exuo pipefail
set -euo pipefail

# Maximum number of retries
MAX_RETRIES=5
Expand Down Expand Up @@ -59,11 +59,14 @@ done

echo "FaaS ready, starting tests."

# Declare arrays to store apps and prefixes globally
declare -a DEPLOYED_APPS
declare -a DEPLOYED_PREFIXES

# Function to run tests
function run_tests() {
local app=$1
local test_func=$2
local delete="${3:-}"

pushd data/$app
deploy
Expand All @@ -73,6 +76,12 @@ function run_tests() {
$test_func $url
popd

# Store the app and prefix information for later use
if [[ "${TEST_FAAS_STARTUP_DEPLOY}" == "true" ]]; then
DEPLOYED_APPS+=("$app")
DEPLOYED_PREFIXES+=("$prefix")
fi

# Test inspect
echo "Testing inspect functionality."

Expand All @@ -92,11 +101,6 @@ function run_tests() {
fi

echo "Inspection test passed."

# Call delete functionality
if [[ "${TEST_FAAS_STARTUP_DEPLOY}" == "true" ]] || [[ "$delete" == "true" ]]; then
delete_functionality $app $prefix
fi
}

# Function to test delete functionality
Expand Down Expand Up @@ -189,11 +193,10 @@ function test_nodejs_app() {
# Run package tests
echo "Running integration tests for package deployment."

# TODO: Parallel tests (uncomment true for deletion)
run_tests "nodejs-base-app" test_nodejs_app # "true"
run_tests "python-base-app" test_python_base_app # "true"
run_tests "python-dependency-app" test_python_dependency_app # "true"
run_tests "nodejs-dependency-app" test_nodejs_dependency_app # "true"
run_tests "nodejs-base-app" test_nodejs_app
run_tests "python-base-app" test_python_base_app
run_tests "python-dependency-app" test_python_dependency_app
run_tests "nodejs-dependency-app" test_nodejs_dependency_app

echo "Integration tests for package deployment passed without errors."

Expand Down Expand Up @@ -314,11 +317,16 @@ function test_simultaneous_deploy() {
done
}

# TODO: Parallel tests

# Run concurrent tests
# echo "Running simultaneous deployments test."
echo "Running simultaneous deployments test."

# test_simultaneous_deploy
if [[ "${TEST_FAAS_STARTUP_DEPLOY}" == "true" ]]; then
test_simultaneous_deploy

# Delete all deployed apps after tests complete
for i in "${!DEPLOYED_APPS[@]}"; do
delete_functionality "${DEPLOYED_APPS[$i]}" "${DEPLOYED_PREFIXES[$i]}"
done
fi

# echo "Simultaneous deployments test tests completed."
echo "Simultaneous deployments test tests completed."

0 comments on commit 50aa680

Please sign in to comment.