Skip to content

Commit

Permalink
Updated keply script to use docker compose instead of docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarTomar97 committed Jun 7, 2024
1 parent 6aef745 commit 4366279
Showing 1 changed file with 33 additions and 36 deletions.
69 changes: 33 additions & 36 deletions .github/workflows/test_workflows/keploy.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,44 @@
#!/bin/bash

# Debugging function to handle errors
handle_error() {
echo "Error on line $1"
exit 1
}

# Trap errors and call the handle_error function
trap 'handle_error $LINENO' ERR

# Fetch the Keploy installation script
curl --silent -O -L https://keploy.io/ent/install.sh
export KEPLOY_API_KEY=Iba1IAlh+GKnXPzYeA==

export DOCKER_BUILDKIT=1
export KEPLOY_API_KEY=Iba1IAlh+GKnXPzYeA==
curl --silent -o keployE --location "https://keploy-enterprise.s3.us-west-2.amazonaws.com/releases/latest/enterprise_linux_amd64"

sudo chmod a+x keployE && sudo mkdir -p /usr/local/bin && sudo mv keployE /usr/local/bin

# Run the Keploy installation script
# bash ./install.sh
source ~/.bashrc

# Install the required node dependencies
# yarn install
export DOCKER_BUILDKIT=1
sudo -E docker-compose --env-file .env.docker build

export ENVIRONMENT_NAME=local
# Build the project locally
sudo -E env PATH="$PATH" yarn build:local
echo "Project built successfully"

# Start keploy in test mode
sudo -E env PATH="$PATH" keployE test -c "sudo docker-compose --env-file .env.docker up" --containerName "custom_app" --delay 50 --apiTimeout 300 --generateGithubActions=false --coverage=false
sudo -E env PATH="$PATH" keployE test -c "sudo docker compose --env-file .env.local up" --containerName "custom_app" --delay 250 --buildDelay 300 --apiTimeout 300 --generateGithubActions=false --coverage=false
echo "Keploy started in test mode"

report_file="./keploy/reports/test-run-0/test-set-4-report.yaml"
test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}')
echo test_status1
# Check the test status variables and exit accordingly
# if [ "$test_status1" = "PASSED" ]; then
echo "All tests passed"
# exit 0
# else
# exit 1
# fi
# Initialize a flag to track the overall test status
all_passed=true

# Loop through test sets 1 to 4
for i in {1..4}
do
# Define the report file for each test set
report_file="./keploy/reports/test-run-0/test-set-$i-report.yaml"

# Extract the test status
test_status=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}')

# Print the status for debugging
echo "Test status for test-set-$i: $test_status"

# Check if any test set did not pass
if [ "$test_status" != "PASSED" ]; then
all_passed=false
echo "Test-set-$i did not pass."
break # Exit the loop early as all tests need to pass
fi
done

# Check the overall test status and exit accordingly
if [ "$all_passed" = true ]; then
echo "All tests passed"
exit 0
else
exit 1
fi

0 comments on commit 4366279

Please sign in to comment.