From 25b08ffb62616ea4d0329f59521783ae37283939 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 14:31:35 +0530 Subject: [PATCH 01/21] fixed workflows and removed serve package Signed-off-by: EraKin575 --- .github/workflows/golang-linux.sh | 85 -------------- .github/workflows/golang_linux.yml | 2 +- .github/workflows/java-linux.sh | 77 ------------- .github/workflows/java_linux.yml | 2 +- .github/workflows/node-linux.sh | 103 ----------------- .github/workflows/node_linux.yml | 2 +- .github/workflows/python-linux.sh | 104 ------------------ .github/workflows/python_linux.yml | 2 +- .../test_workflow_scripts/golang-linux.sh | 89 --------------- .../test_workflow_scripts/java-linux.sh | 17 +-- .../test_workflow_scripts/node-linux.sh | 15 +-- .../test_workflow_scripts/python-linux.sh | 16 ++- pkg/{service/serve => graph}/gqlgen.yml | 0 pkg/{service/serve => graph}/tools.go | 0 pkg/service/serve/README.md | 4 - pkg/service/serve/service.go | 5 - 16 files changed, 22 insertions(+), 501 deletions(-) delete mode 100644 .github/workflows/golang-linux.sh delete mode 100644 .github/workflows/java-linux.sh delete mode 100755 .github/workflows/node-linux.sh delete mode 100644 .github/workflows/python-linux.sh delete mode 100755 .github/workflows/test_workflow_scripts/golang-linux.sh mode change 100755 => 100644 .github/workflows/test_workflow_scripts/java-linux.sh mode change 100644 => 100755 .github/workflows/test_workflow_scripts/node-linux.sh mode change 100755 => 100644 .github/workflows/test_workflow_scripts/python-linux.sh rename pkg/{service/serve => graph}/gqlgen.yml (100%) rename pkg/{service/serve => graph}/tools.go (100%) delete mode 100755 pkg/service/serve/README.md delete mode 100644 pkg/service/serve/service.go diff --git a/.github/workflows/golang-linux.sh b/.github/workflows/golang-linux.sh deleted file mode 100644 index 41f0fd0a0..000000000 --- a/.github/workflows/golang-linux.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -# Checkout a different branch -git fetch origin -git checkout native-linux - -# Start mongo before starting keploy. -docker run --rm -d -p27017:27017 --name mongoDb mongo - -# Check if there is a keploy-config file, if there is, delete it. -if [ -f "./keploy-config.yaml" ]; then - rm ./keploy-config.yaml -fi - -# Generate the keploy-config file. -./../../keployv2 generate-config - -# Update the global noise to ts. -config_file="./keploy-config.yaml" -sed -i 's/body: {}/body: {"ts":[]}/' "$config_file" - -# Remove any preexisting keploy tests and mocks. -sudo rm -rf keploy/ - -# Build the binary. -go build -o ginApp - -for i in {1..2}; do -# Start the gin-mongo app in record mode and record testcases and mocks. -sudo -E env PATH="$PATH" ./../../keployv2 record -c "./ginApp" & - -# Wait for the application to start. -app_started=false -while [ "$app_started" = false ]; do - if curl -X GET http://localhost:8080/CJBKJd92; then - app_started=true - fi - sleep 3 # wait for 3 seconds before checking again. -done - -# Get the pid of the application. -pid=$(pgrep keploy) - -# Start making curl calls to record the testcases and mocks. -curl --request POST \ - --url http://localhost:8080/url \ - --header 'content-type: application/json' \ - --data '{ - "url": "https://google.com" -}' - -curl --request POST \ - --url http://localhost:8080/url \ - --header 'content-type: application/json' \ - --data '{ - "url": "https://facebook.com" -}' - -curl -X GET http://localhost:8080/CJBKJd92 - -# Wait for 5 seconds for keploy to record the tcs and mocks. -sleep 5 - -# Stop the gin-mongo app. -sudo kill $pid - -# Wait for 5 seconds for keploy to stop. -sleep 5 -done - -# Start the gin-mongo app in test omde. -sudo -E env PATH="$PATH" ./../../keployv2 test -c "./ginApp" --delay 7 - -# Get the test results from the testReport file. -report_file="./keploy/testReports/test-run-1/report-1.yaml" -test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') -report_file2="./keploy/testReports/test-run-1/report-1.yaml" -test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') - -# Return the exit code according to the status. -if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ]; then - exit 0 -else - exit 1 -fi \ No newline at end of file diff --git a/.github/workflows/golang_linux.yml b/.github/workflows/golang_linux.yml index d4a46df87..6449563ed 100644 --- a/.github/workflows/golang_linux.yml +++ b/.github/workflows/golang_linux.yml @@ -18,5 +18,5 @@ jobs: - name: Run samples-go application run: | cd samples-go/gin-mongo - source ./../../.github/workflows/golang-linux.sh + source ./../../.github/workflows/test_workflow_scripts/golang-linux.sh diff --git a/.github/workflows/java-linux.sh b/.github/workflows/java-linux.sh deleted file mode 100644 index 5109c23fa..000000000 --- a/.github/workflows/java-linux.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /bin/bash - -# Start postgres instance. -docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 - -# Update the java version -source ./../../../.github/workflows/update-java.sh - -# Remove any existing test and mocks by keploy. -sudo rm -rf keploy/ - -for i in {1..2}; do -# Start keploy in record mode. -sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & - -# Wait for the application to start. -app_started=false -while [ "$app_started" = false ]; do - if curl -X GET http://localhost:9966/petclinic/api/pettypes; then - app_started=true - fi - sleep 3 # wait for 3 seconds before checking again. -done - -# Get the pid of the application. -pid=$(pgrep keploy) - -# Start making curl calls to record the testcases and mocks. -curl -X GET http://localhost:9966/petclinic/api/pettypes - -curl --request POST \ ---url http://localhost:9966/petclinic/api/pettypes \ - --header 'content-type: application/json' \ - --data '{ - "name":"John Doe"}' - -curl -X GET http://localhost:9966/petclinic/api/pettypes - -curl --request POST \ ---url http://localhost:9966/petclinic/api/pettypes \ - --header 'content-type: application/json' \ - --data '{ - "name":"Alice Green"}' - -curl -X GET http://localhost:9966/petclinic/api/pettypes - - curl --request DELETE \ ---url http://localhost:9966/petclinic/api/pettypes/1 - -curl -X GET http://localhost:9966/petclinic/api/pettypes - -# Wait for 5 seconds for keploy to record the tcs and mocks. -sleep 5 - -# Stop keploy. -sudo kill $pid - -# Wait for 5 seconds for keploy to stop. -sleep 5 - -done - -# Start keploy in test mode. -sudo -E env PATH=$PATH ./../../../keployv2 test -c './mvnw spring-boot:run' --delay 20 - -# Get the test results from the testReport file. -report_file="./keploy/testReports/test-run-1/report-1.yaml" -test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') -report_file2="./keploy/testReports/test-run-1/report-2.yaml" -test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') - -# Return the exit code according to the status. -if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ]; then - exit 0 -else - exit 1 -fi \ No newline at end of file diff --git a/.github/workflows/java_linux.yml b/.github/workflows/java_linux.yml index 7462eebe0..a61d8057d 100644 --- a/.github/workflows/java_linux.yml +++ b/.github/workflows/java_linux.yml @@ -31,4 +31,4 @@ jobs: - name: Run the spring-petclinic-rest app run: | cd samples-java/spring-petclinic/spring-petclinic-rest - source ./../../../.github/workflows/java-linux.sh \ No newline at end of file + source ./../../../.github/workflows/test_workflow_scripts/java-linux.sh \ No newline at end of file diff --git a/.github/workflows/node-linux.sh b/.github/workflows/node-linux.sh deleted file mode 100755 index f9cb2417f..000000000 --- a/.github/workflows/node-linux.sh +++ /dev/null @@ -1,103 +0,0 @@ -#! /bin/bash - -source ./../../.github/workflows/test_workflow_scripts/test-iid.sh - -# Start the docker container. -docker run --name mongoDb --rm -p 27017:27017 -d mongo - -# Install the required node dependencies. -npm install - -# Edit the connection.js file to connect to local mongodb. -file_path="src/db/connection.js" -sed -i "s/mongoDb:27017/localhost:27017/" "$file_path" - -# Remove any preexisting keploy tests. -rm -rf keploy/ - -for i in {1..2}; do -# Start keploy in record mode. -sudo -E env PATH=$PATH ./../../keployv2 record -c 'npm start' & - -# Wait for the application to start. -app_started=false -while [ "$app_started" = false ]; do - if curl -X GET http://localhost:8000/students; then - app_started=true - fi - sleep 3 # wait for 3 seconds before checking again. -done - -# Get the pid of the application. -pid=$(pgrep keploy) - -# Start making curl calls to record the testcases and mocks. -curl --request POST \ ---url http://localhost:8000/students \ - --header 'content-type: application/json' \ - --data '{ - "name":"John Do", - "email":"john@xyiz.com", - "phone":"0123456799" - }' - -curl --request POST \ ---url http://localhost:8000/students \ - --header 'content-type: application/json' \ - --data '{ - "name":"Alice Green", - "email":"green@alice.com", - "phone":"3939201584" - }' - -curl -X GET http://localhost:8000/students - -# Wait for 5 seconds for keploy to record the tcs and mocks. -sleep 5 - -# Stop keploy. -sudo kill $pid - -# Wait for 5 seconds for keploy to stop. -sleep 5 -done - -# Start keploy in test mode. -sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 - -sudo -E env PATH=$PATH ./../../keployv2 test -c "npm test" --delay 5 --coverage - -sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 --testsets test-set-0 - -# Generate the keploy-config file. -./../../keployv2 generate-config - -# Update the global noise to ts. -config_file="./keploy-config.yaml" -sed -i '/tests:/a \ "test-set-0": ["test-1", "test-2"]' "$config_file" - - -sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --apiTimeout 30 --delay 10 - -# Get the test results from the testReport file. -report_file="./keploy/testReports/test-run-1/report-1.yaml" -test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') -report_file2="./keploy/testReports/test-run-1/report-2.yaml" -test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') -report_file3="./keploy/testReports/test-run-2/report-1.yaml" -test_status3=$(grep 'status:' "$report_file3" | head -n 1 | awk '{print $2}') -report_file4="./keploy/testReports/test-run-2/report-2.yaml" -test_status4=$(grep 'status:' "$report_file4" | head -n 1 | awk '{print $2}') -report_file5="./keploy/testReports/test-run-3/report-1.yaml" -test_status5=$(grep 'status:' "$report_file5" | head -n 1 | awk '{print $2}') -report_file6="./keploy/testReports/test-run-4/report-1.yaml" -test_status6=$(grep 'status:' "$report_file6" | head -n 1 | awk '{print $2}') -test_total6=$(grep 'total:' "$report_file6" | head -n 1 | awk '{print $2}') -test_failure=$(grep 'failure:' "$report_file6" | head -n 1 | awk '{print $2}') - -# Return the exit code according to the status. -if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ] && [ "$test_status3" = "PASSED" ] && [ "$test_status4" = "PASSED" ] && [ "$test_status5" = "PASSED" ] && [ "$test_status6" = "PASSED" ] && [ "$test_total6" = "2" ] && [ "$test_failure" = "0" ]; then - exit 0 -else - exit 1 -fi diff --git a/.github/workflows/node_linux.yml b/.github/workflows/node_linux.yml index babe52c30..a5e1c6d65 100644 --- a/.github/workflows/node_linux.yml +++ b/.github/workflows/node_linux.yml @@ -20,4 +20,4 @@ jobs: - name: Run the express-mongoose app run: | cd samples-typescript/express-mongoose - source ./../../.github/workflows/node-linux.sh \ No newline at end of file + source ./../../.github/workflows/test_workflow_scripts/node-linux.sh \ No newline at end of file diff --git a/.github/workflows/python-linux.sh b/.github/workflows/python-linux.sh deleted file mode 100644 index 785246401..000000000 --- a/.github/workflows/python-linux.sh +++ /dev/null @@ -1,104 +0,0 @@ -#! /bin/bash - -# Checkout a different branch -git fetch origin -git checkout native-linux - -# Start the postgres database. -docker-compose up -d - -# Install the dependencies. -pip3 install -r requirements.txt - -# Set the environment variable for the app to run correctly. -export PYTHON_PATH=./venv/lib/python3.10/site-packages/django - -# Make the required migrations. -python3 manage.py makemigrations -python3 manage.py migrate - -# Generate the keploy-config file. -./../../../keployv2 generate-config - -#Clean any keploy folders. -sudo rm -rf keploy/ - -# Update the global noise to ignore the Allow header. -config_file="./keploy-config.yaml" -sed -i 's/header: {}/header: {"Allow":[]}/' "$config_file" - -# Wait for 5 seconds for it to complete -sleep 5 - -for i in {1..2}; do -# Start the django-postgres app in record mode and record testcases and mocks. -sudo -E env PATH="$PATH" ./../../../keployv2 record -c "python3 manage.py runserver" & - -# Wait for the application to start. -app_started=false -while [ "$app_started" = false ]; do - if curl --location 'http://127.0.0.1:8000/'; then - app_started=true - fi - sleep 3 # wait for 3 seconds before checking again. -done - -# Get the pid of keploy. -pid=$(pgrep keploy) - -# Start making curl calls to record the testcases and mocks. -curl --location 'http://127.0.0.1:8000/user/' \ ---header 'Content-Type: application/json' \ ---data-raw ' { - "name": "Jane Smith", - "email": "jane.smith@example.com", - "password": "smith567", - "website": "www.janesmith.com" - }' - -curl --location 'http://127.0.0.1:8000/user/' \ ---header 'Content-Type: application/json' \ ---data-raw ' { - "name": "John Doe", - "email": "john.doe@example.com", - "password": "john567", - "website": "www.johndoe.com" - }' - -curl --location 'http://127.0.0.1:8000/user/' - -curl --location 'http://127.0.0.1:8000/user/' \ ---header 'Content-Type: application/json' \ ---data-raw ' { - "name": "John Doe", - "email": "john.doe@example.com", - "password": "john567", - "website": "www.johndoe.com" - }' - -# Wait for 5 seconds for keploy to record the tcs and mocks. -sleep 5 - -# Stop the gin-mongo app. -sudo kill $pid - -# Wait for 5 seconds for keploy to stop. -sleep 5 -done - -# Start the app in test mode. -sudo -E env PATH="$PATH" ./../../../keployv2 test -c "python3 manage.py runserver" --delay 10 - -# Get the test results from the testReport file. -report_file="./keploy/testReports/test-run-1/report-1.yaml" -test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') -report_file2="./keploy/testReports/test-run-1/report-2.yaml" -test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') - -# Return the exit code according to the status. -if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ]; then - exit 0 -else - exit 1 -fi - diff --git a/.github/workflows/python_linux.yml b/.github/workflows/python_linux.yml index 74c15b103..bef730d29 100644 --- a/.github/workflows/python_linux.yml +++ b/.github/workflows/python_linux.yml @@ -18,4 +18,4 @@ jobs: - name: Run the sample python application run: | cd samples-python/django-postgres/django_postgres - source ../../../.github/workflows/python-linux.sh + source ../../../.github/workflows/test_workflow_scripts/python-linux.sh diff --git a/.github/workflows/test_workflow_scripts/golang-linux.sh b/.github/workflows/test_workflow_scripts/golang-linux.sh deleted file mode 100755 index 5a742722b..000000000 --- a/.github/workflows/test_workflow_scripts/golang-linux.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -source ./../../.github/workflows/test_workflow_scripts/test-iid.sh - -# Checkout a different branch -git fetch origin -git checkout native-linux - -# Start mongo before starting keploy. -docker run --rm -d -p27017:27017 --name mongoDb mongo - -# Check if there is a keploy-config file, if there is, delete it. -if [ -f "./keploy-config.yaml" ]; then - rm ./keploy-config.yaml -fi - -# Generate the keploy-config file. -./../../keployv2 generate-config - -# Update the global noise to ts. -config_file="./keploy-config.yaml" -sed -i 's/body: {}/body: {"ts":[]}/' "$config_file" - -# Remove any preexisting keploy tests and mocks. -rm -rf keploy/ - -# Build the binary. -go build -o ginApp - -for i in {1..2}; do -# Start the gin-mongo app in record mode and record testcases and mocks. -sudo -E env PATH="$PATH" ./../../keployv2 record -c "./ginApp" & - -# Wait for the application to start. -app_started=false -while [ "$app_started" = false ]; do - if curl -X GET http://localhost:8080/CJBKJd92; then - app_started=true - fi - sleep 3 # wait for 3 seconds before checking again. -done - -# Get the pid of the application. -pid=$(pgrep keploy) - -# Start making curl calls to record the testcases and mocks. -curl --request POST \ - --url http://localhost:8080/url \ - --header 'content-type: application/json' \ - --data '{ - "url": "https://google.com" -}' - -curl --request POST \ - --url http://localhost:8080/url \ - --header 'content-type: application/json' \ - --data '{ - "url": "https://facebook.com" -}' - -curl -X GET http://localhost:8080/CJBKJd92 - -# Wait for 5 seconds for keploy to record the tcs and mocks. -sleep 5 - -# Stop the gin-mongo app. -sudo kill $pid - -# Wait for 5 seconds for keploy to stop. -sleep 5 -done - -# Start the gin-mongo app in test omde. -sudo -E env PATH="$PATH" ./../../keployv2 test -c "./ginApp" --apiTimeout 30 --delay 7 - -# Get the test results from the testReport file. -report_file="./keploy/testReports/test-run-1/report-1.yaml" -test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') -report_file2="./keploy/testReports/test-run-1/report-2.yaml" -test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') - -# Return the exit code according to the status. -if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ]; then - exit 0 -else - exit 1 -fi - -docker stop mongoDb \ No newline at end of file diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh old mode 100755 new mode 100644 index 357ec7b6f..5109c23fa --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -1,28 +1,17 @@ #! /bin/bash -source ./../../../.github/workflows/workflow_scripts/fake-iid.sh - -# Checkout a different branch -git fetch origin -git checkout native-linux - # Start postgres instance. docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version -source ./../../../.github/workflows/workflow_scripts/update-java.sh +source ./../../../.github/workflows/update-java.sh # Remove any existing test and mocks by keploy. sudo rm -rf keploy/ -# Update the postgres database. -docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql -docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql - for i in {1..2}; do # Start keploy in record mode. -mvn clean install -Dmaven.test.skip=true -sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & +sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & # Wait for the application to start. app_started=false @@ -72,7 +61,7 @@ sleep 5 done # Start keploy in test mode. -sudo -E env PATH=$PATH ./../../../keployv2 test -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' --delay 20 +sudo -E env PATH=$PATH ./../../../keployv2 test -c './mvnw spring-boot:run' --delay 20 # Get the test results from the testReport file. report_file="./keploy/testReports/test-run-1/report-1.yaml" diff --git a/.github/workflows/test_workflow_scripts/node-linux.sh b/.github/workflows/test_workflow_scripts/node-linux.sh old mode 100644 new mode 100755 index a7626b4e4..f9cb2417f --- a/.github/workflows/test_workflow_scripts/node-linux.sh +++ b/.github/workflows/test_workflow_scripts/node-linux.sh @@ -65,7 +65,7 @@ done # Start keploy in test mode. sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 -sudo -E env PATH=$PATH ./../../keployv2 serve -c "npm test" --delay 5 +sudo -E env PATH=$PATH ./../../keployv2 test -c "npm test" --delay 5 --coverage sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 --testsets test-set-0 @@ -76,20 +76,21 @@ sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 --testset config_file="./keploy-config.yaml" sed -i '/tests:/a \ "test-set-0": ["test-1", "test-2"]' "$config_file" + sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --apiTimeout 30 --delay 10 # Get the test results from the testReport file. -report_file="./keploy/testReports/test-report-0/report-1.yaml" +report_file="./keploy/testReports/test-run-1/report-1.yaml" test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') -report_file2="./keploy/testReports/test-report-0/report-2.yaml" +report_file2="./keploy/testReports/test-run-1/report-2.yaml" test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') -report_file3="./keploy/testReports/test-report-0/report-3.yaml" +report_file3="./keploy/testReports/test-run-2/report-1.yaml" test_status3=$(grep 'status:' "$report_file3" | head -n 1 | awk '{print $2}') -report_file4="./keploy/testReports/test-report-0/report-4.yaml" +report_file4="./keploy/testReports/test-run-2/report-2.yaml" test_status4=$(grep 'status:' "$report_file4" | head -n 1 | awk '{print $2}') -report_file5="./keploy/testReports/test-report-0/report-5.yaml" +report_file5="./keploy/testReports/test-run-3/report-1.yaml" test_status5=$(grep 'status:' "$report_file5" | head -n 1 | awk '{print $2}') -report_file6="./keploy/testReports/test-report-0/report-6.yaml" +report_file6="./keploy/testReports/test-run-4/report-1.yaml" test_status6=$(grep 'status:' "$report_file6" | head -n 1 | awk '{print $2}') test_total6=$(grep 'total:' "$report_file6" | head -n 1 | awk '{print $2}') test_failure=$(grep 'failure:' "$report_file6" | head -n 1 | awk '{print $2}') diff --git a/.github/workflows/test_workflow_scripts/python-linux.sh b/.github/workflows/test_workflow_scripts/python-linux.sh old mode 100755 new mode 100644 index 69fb3488c..785246401 --- a/.github/workflows/test_workflow_scripts/python-linux.sh +++ b/.github/workflows/test_workflow_scripts/python-linux.sh @@ -1,7 +1,5 @@ #! /bin/bash -source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh - # Checkout a different branch git fetch origin git checkout native-linux @@ -23,7 +21,7 @@ python3 manage.py migrate ./../../../keployv2 generate-config #Clean any keploy folders. -rm -rf keploy/ +sudo rm -rf keploy/ # Update the global noise to ignore the Allow header. config_file="./keploy-config.yaml" @@ -39,7 +37,7 @@ sudo -E env PATH="$PATH" ./../../../keployv2 record -c "python3 manage.py runser # Wait for the application to start. app_started=false while [ "$app_started" = false ]; do - if curl --location 'http://127.0.0.1:8000/user'; then + if curl --location 'http://127.0.0.1:8000/'; then app_started=true fi sleep 3 # wait for 3 seconds before checking again. @@ -72,10 +70,10 @@ curl --location 'http://127.0.0.1:8000/user/' curl --location 'http://127.0.0.1:8000/user/' \ --header 'Content-Type: application/json' \ --data-raw ' { - "name": "Alice green", - "email": "alice.green@example.com", - "password": "alice789", - "website": "www.alicegreen.com" + "name": "John Doe", + "email": "john.doe@example.com", + "password": "john567", + "website": "www.johndoe.com" }' # Wait for 5 seconds for keploy to record the tcs and mocks. @@ -89,7 +87,7 @@ sleep 5 done # Start the app in test mode. -sudo -E env PATH="$PATH" ./../../../keployv2 test -c "python3 manage.py runserver" --apiTimeout 30 --delay 20 +sudo -E env PATH="$PATH" ./../../../keployv2 test -c "python3 manage.py runserver" --delay 10 # Get the test results from the testReport file. report_file="./keploy/testReports/test-run-1/report-1.yaml" diff --git a/pkg/service/serve/gqlgen.yml b/pkg/graph/gqlgen.yml similarity index 100% rename from pkg/service/serve/gqlgen.yml rename to pkg/graph/gqlgen.yml diff --git a/pkg/service/serve/tools.go b/pkg/graph/tools.go similarity index 100% rename from pkg/service/serve/tools.go rename to pkg/graph/tools.go diff --git a/pkg/service/serve/README.md b/pkg/service/serve/README.md deleted file mode 100755 index fee972cbc..000000000 --- a/pkg/service/serve/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Record Package Documentation - -This package provides an interface to run a graphql server used in running keploy tests along with unit tests of the application. The interface methods will be -called from the `cmd` package. diff --git a/pkg/service/serve/service.go b/pkg/service/serve/service.go deleted file mode 100644 index 825ee6b81..000000000 --- a/pkg/service/serve/service.go +++ /dev/null @@ -1,5 +0,0 @@ -package serve - -type Server interface { - Serve(path string, proxyPort uint32, testReportPath string, Delay uint64, pid, port uint32, lang string, passThroughPorts []uint, apiTimeout uint64, appCmd string, enableTele bool) -} From a18d5058e058201a31ee80f4c1a8d27261040e9c Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 14:35:58 +0530 Subject: [PATCH 02/21] fixed workflows and removed serve package Signed-off-by: EraKin575 --- .../test_workflow_scripts/golang-linux.sh | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/test_workflow_scripts/golang-linux.sh diff --git a/.github/workflows/test_workflow_scripts/golang-linux.sh b/.github/workflows/test_workflow_scripts/golang-linux.sh new file mode 100644 index 000000000..41f0fd0a0 --- /dev/null +++ b/.github/workflows/test_workflow_scripts/golang-linux.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Checkout a different branch +git fetch origin +git checkout native-linux + +# Start mongo before starting keploy. +docker run --rm -d -p27017:27017 --name mongoDb mongo + +# Check if there is a keploy-config file, if there is, delete it. +if [ -f "./keploy-config.yaml" ]; then + rm ./keploy-config.yaml +fi + +# Generate the keploy-config file. +./../../keployv2 generate-config + +# Update the global noise to ts. +config_file="./keploy-config.yaml" +sed -i 's/body: {}/body: {"ts":[]}/' "$config_file" + +# Remove any preexisting keploy tests and mocks. +sudo rm -rf keploy/ + +# Build the binary. +go build -o ginApp + +for i in {1..2}; do +# Start the gin-mongo app in record mode and record testcases and mocks. +sudo -E env PATH="$PATH" ./../../keployv2 record -c "./ginApp" & + +# Wait for the application to start. +app_started=false +while [ "$app_started" = false ]; do + if curl -X GET http://localhost:8080/CJBKJd92; then + app_started=true + fi + sleep 3 # wait for 3 seconds before checking again. +done + +# Get the pid of the application. +pid=$(pgrep keploy) + +# Start making curl calls to record the testcases and mocks. +curl --request POST \ + --url http://localhost:8080/url \ + --header 'content-type: application/json' \ + --data '{ + "url": "https://google.com" +}' + +curl --request POST \ + --url http://localhost:8080/url \ + --header 'content-type: application/json' \ + --data '{ + "url": "https://facebook.com" +}' + +curl -X GET http://localhost:8080/CJBKJd92 + +# Wait for 5 seconds for keploy to record the tcs and mocks. +sleep 5 + +# Stop the gin-mongo app. +sudo kill $pid + +# Wait for 5 seconds for keploy to stop. +sleep 5 +done + +# Start the gin-mongo app in test omde. +sudo -E env PATH="$PATH" ./../../keployv2 test -c "./ginApp" --delay 7 + +# Get the test results from the testReport file. +report_file="./keploy/testReports/test-run-1/report-1.yaml" +test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}') +report_file2="./keploy/testReports/test-run-1/report-1.yaml" +test_status2=$(grep 'status:' "$report_file2" | head -n 1 | awk '{print $2}') + +# Return the exit code according to the status. +if [ "$test_status1" = "PASSED" ] && [ "$test_status2" = "PASSED" ]; then + exit 0 +else + exit 1 +fi \ No newline at end of file From 2c289cd8fe05160f1141a5a7368414d37b6975cf Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:12:52 +0530 Subject: [PATCH 03/21] fixed workflows Signed-off-by: EraKin575 --- .../test_workflow_scripts/golang-linux.sh | 4 +++- .../test_workflow_scripts/java-linux.sh | 17 +++++++++++++---- .../test_workflow_scripts/update-java.sh | 2 +- .github/workflows/update-java.sh | 6 ------ 4 files changed, 17 insertions(+), 12 deletions(-) mode change 100755 => 100644 .github/workflows/test_workflow_scripts/update-java.sh delete mode 100644 .github/workflows/update-java.sh diff --git a/.github/workflows/test_workflow_scripts/golang-linux.sh b/.github/workflows/test_workflow_scripts/golang-linux.sh index 41f0fd0a0..6b81cbf54 100644 --- a/.github/workflows/test_workflow_scripts/golang-linux.sh +++ b/.github/workflows/test_workflow_scripts/golang-linux.sh @@ -1,5 +1,7 @@ #!/bin/bash +source ./../../.github/workflows/test_workflow_scripts/test-iid.sh + # Checkout a different branch git fetch origin git checkout native-linux @@ -20,7 +22,7 @@ config_file="./keploy-config.yaml" sed -i 's/body: {}/body: {"ts":[]}/' "$config_file" # Remove any preexisting keploy tests and mocks. -sudo rm -rf keploy/ +rm -rf keploy/ # Build the binary. go build -o ginApp diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 5109c23fa..00122d199 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -1,17 +1,26 @@ #! /bin/bash +source ./../../../.github/workflows/workflow_scripts/fake-iid.sh + +# Checkout a different branch +git fetch origin +git checkout native-linux + # Start postgres instance. docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version -source ./../../../.github/workflows/update-java.sh +source ./../../../.github/workflows/test_workflows_scripts/update-java.sh # Remove any existing test and mocks by keploy. -sudo rm -rf keploy/ + +docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql +docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql for i in {1..2}; do # Start keploy in record mode. -sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & +sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/*.jar' & + # Wait for the application to start. app_started=false @@ -61,7 +70,7 @@ sleep 5 done # Start keploy in test mode. -sudo -E env PATH=$PATH ./../../../keployv2 test -c './mvnw spring-boot:run' --delay 20 +sudo -E env PATH=$PATH ./../../../keployv2 test -c 'java -jar target/*.jar' --delay 20 # Get the test results from the testReport file. report_file="./keploy/testReports/test-run-1/report-1.yaml" diff --git a/.github/workflows/test_workflow_scripts/update-java.sh b/.github/workflows/test_workflow_scripts/update-java.sh old mode 100755 new mode 100644 index 0244f2eac..f744fbb11 --- a/.github/workflows/test_workflow_scripts/update-java.sh +++ b/.github/workflows/test_workflow_scripts/update-java.sh @@ -2,7 +2,7 @@ # Update the java version sudo apt update -sudo apt install openjdk-17-jdk -y +sudo apt install openjdk-17-jre -y export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH source ~/.bashrc \ No newline at end of file diff --git a/.github/workflows/update-java.sh b/.github/workflows/update-java.sh deleted file mode 100644 index 5955e9f29..000000000 --- a/.github/workflows/update-java.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/bash - -# Update the java version -sudo apt update -sudo apt install openjdk-17-jre -y -export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \ No newline at end of file From ee196fa6bb0c7a74abd7621ab59c496a6b227012 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:14:35 +0530 Subject: [PATCH 04/21] fixed workflows Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 00122d199..53ee55431 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -19,7 +19,7 @@ docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql for i in {1..2}; do # Start keploy in record mode. -sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/*.jar' & +sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & # Wait for the application to start. @@ -70,7 +70,7 @@ sleep 5 done # Start keploy in test mode. -sudo -E env PATH=$PATH ./../../../keployv2 test -c 'java -jar target/*.jar' --delay 20 +sudo -E env PATH=$PATH ./../../../keployv2 test -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' --delay 20 # Get the test results from the testReport file. report_file="./keploy/testReports/test-run-1/report-1.yaml" From 0c6097fb9d8a2fab11850157adad674140a4566c Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:30:40 +0530 Subject: [PATCH 05/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/java_linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java_linux.yml b/.github/workflows/java_linux.yml index a61d8057d..9355173e4 100644 --- a/.github/workflows/java_linux.yml +++ b/.github/workflows/java_linux.yml @@ -25,7 +25,7 @@ jobs: - name: Compile the project run: | cd samples-java/spring-petclinic/spring-petclinic-rest - source ./../../../.github/workflows/update-java.sh + source ./../../../.github/workflows/test_workflow_scripts/update-java.sh ./mvnw compile - name: Run the spring-petclinic-rest app From 537a7313000f67fa18d29721d5e2c5466d50d64f Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:33:28 +0530 Subject: [PATCH 06/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 53ee55431..2b98d1e86 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -1,6 +1,6 @@ #! /bin/bash -source ./../../../.github/workflows/workflow_scripts/fake-iid.sh +source ./../../../.github/workflows/workflow_scripts/test-iid.sh # Checkout a different branch git fetch origin From e48eac5ccea490d03b77a9cc0a8af9e516f55e03 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:35:37 +0530 Subject: [PATCH 07/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 2b98d1e86..47580b9a5 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -1,6 +1,6 @@ #! /bin/bash -source ./../../../.github/workflows/workflow_scripts/test-iid.sh +source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh # Checkout a different branch git fetch origin From 23d1da15f972f44a00c54fdf3499ae72bc5ccf8b Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:38:39 +0530 Subject: [PATCH 08/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 47580b9a5..d63e4f312 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -10,7 +10,7 @@ git checkout native-linux docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version -source ./../../../.github/workflows/test_workflows_scripts/update-java.sh +source ./../../../.github/workflows/test_workflow_scripts/update-java.sh # Remove any existing test and mocks by keploy. From 33a92fca1e7552eff044a9a29bcc7e3e868bc53a Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:46:39 +0530 Subject: [PATCH 09/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index d63e4f312..eed2a8c28 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -13,15 +13,17 @@ docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTG source ./../../../.github/workflows/test_workflow_scripts/update-java.sh # Remove any existing test and mocks by keploy. +sudo rm -rf keploy/ +# Update the postgres database. docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql for i in {1..2}; do # Start keploy in record mode. +mvn clean install -Dmaven.test.skip=true sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & - # Wait for the application to start. app_started=false while [ "$app_started" = false ]; do From 7d685762b38a280a23b3f95526239baa672b7233 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 18:51:02 +0530 Subject: [PATCH 10/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index eed2a8c28..a15e0951a 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -7,7 +7,7 @@ git fetch origin git checkout native-linux # Start postgres instance. -docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d --name mypostgres -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh @@ -16,7 +16,7 @@ source ./../../../.github/workflows/test_workflow_scripts/update-java.sh sudo rm -rf keploy/ # Update the postgres database. -docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql +docker cp ./src/main/resources/db/postgresql/initDB.sql petclinic:/initDB.sql docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql for i in {1..2}; do From 1064d096b7b6f45cfd3c22232187203e2b17abac Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 19:02:17 +0530 Subject: [PATCH 11/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index a15e0951a..f09e4666c 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -6,8 +6,9 @@ source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh git fetch origin git checkout native-linux + # Start postgres instance. -docker run -d --name mypostgres -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh @@ -15,13 +16,8 @@ source ./../../../.github/workflows/test_workflow_scripts/update-java.sh # Remove any existing test and mocks by keploy. sudo rm -rf keploy/ -# Update the postgres database. -docker cp ./src/main/resources/db/postgresql/initDB.sql petclinic:/initDB.sql -docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql - for i in {1..2}; do # Start keploy in record mode. -mvn clean install -Dmaven.test.skip=true sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & # Wait for the application to start. From b07b3ed8e417c50ded35cc990d698c20bc3df413 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 19:24:06 +0530 Subject: [PATCH 12/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index f09e4666c..eed2a8c28 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -6,7 +6,6 @@ source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh git fetch origin git checkout native-linux - # Start postgres instance. docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 @@ -16,8 +15,13 @@ source ./../../../.github/workflows/test_workflow_scripts/update-java.sh # Remove any existing test and mocks by keploy. sudo rm -rf keploy/ +# Update the postgres database. +docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql +docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql + for i in {1..2}; do # Start keploy in record mode. +mvn clean install -Dmaven.test.skip=true sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & # Wait for the application to start. From fe9fb6fc0b2865bd3c7bbb623d0137c514c21313 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 19:28:40 +0530 Subject: [PATCH 13/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index eed2a8c28..bc842508e 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -7,7 +7,7 @@ git fetch origin git checkout native-linux # Start postgres instance. -docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d --name mypostgres -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh From d0abcd30fe3d7c5374d52437ddf40a683ff0f5a3 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 20:12:44 +0530 Subject: [PATCH 14/21] fixed java workflow Signed-off-by: EraKin575 --- .../workflows/test_workflow_scripts/java-linux.sh | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index bc842508e..519cdb4bb 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -1,13 +1,7 @@ #! /bin/bash -source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh - -# Checkout a different branch -git fetch origin -git checkout native-linux - # Start postgres instance. -docker run -d --name mypostgres -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh @@ -15,13 +9,8 @@ source ./../../../.github/workflows/test_workflow_scripts/update-java.sh # Remove any existing test and mocks by keploy. sudo rm -rf keploy/ -# Update the postgres database. -docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql -docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql - for i in {1..2}; do # Start keploy in record mode. -mvn clean install -Dmaven.test.skip=true sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & # Wait for the application to start. From 82afe142b6fc87aeb4d329dea3a776d9847d467a Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 20:35:23 +0530 Subject: [PATCH 15/21] fixed java workflow Signed-off-by: EraKin575 --- .../workflows/test_workflow_scripts/java-linux.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 519cdb4bb..bc842508e 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -1,7 +1,13 @@ #! /bin/bash +source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh + +# Checkout a different branch +git fetch origin +git checkout native-linux + # Start postgres instance. -docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d --name mypostgres -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh @@ -9,8 +15,13 @@ source ./../../../.github/workflows/test_workflow_scripts/update-java.sh # Remove any existing test and mocks by keploy. sudo rm -rf keploy/ +# Update the postgres database. +docker cp ./src/main/resources/db/postgresql/initDB.sql mypostgres:/initDB.sql +docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql + for i in {1..2}; do # Start keploy in record mode. +mvn clean install -Dmaven.test.skip=true sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & # Wait for the application to start. From 825a87ce758c17e4b74c4f84ec927249a62217f0 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Thu, 25 Jan 2024 20:40:51 +0530 Subject: [PATCH 16/21] fixed java workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index bc842508e..8fc9c214a 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -22,7 +22,7 @@ docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql for i in {1..2}; do # Start keploy in record mode. mvn clean install -Dmaven.test.skip=true -sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & +sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & # Wait for the application to start. app_started=false @@ -72,7 +72,7 @@ sleep 5 done # Start keploy in test mode. -sudo -E env PATH=$PATH ./../../../keployv2 test -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' --delay 20 +sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & # Get the test results from the testReport file. report_file="./keploy/testReports/test-run-1/report-1.yaml" From cb00578fbc157b5ca6336b420dbfb4bf5a86d5e0 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Fri, 26 Jan 2024 11:27:14 +0530 Subject: [PATCH 17/21] changed java workflows Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 8fc9c214a..eed2a8c28 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -7,7 +7,7 @@ git fetch origin git checkout native-linux # Start postgres instance. -docker run -d --name mypostgres -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh @@ -22,7 +22,7 @@ docker exec mypostgres psql -U petclinic -d petclinic -f /initDB.sql for i in {1..2}; do # Start keploy in record mode. mvn clean install -Dmaven.test.skip=true -sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & +sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' & # Wait for the application to start. app_started=false @@ -72,7 +72,7 @@ sleep 5 done # Start keploy in test mode. -sudo -E env PATH=$PATH ./../../../keployv2 record -c './mvnw spring-boot:run' & +sudo -E env PATH=$PATH ./../../../keployv2 test -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' --delay 20 # Get the test results from the testReport file. report_file="./keploy/testReports/test-run-1/report-1.yaml" From 303da43ca47e5c6343749d05e4659788112e50c1 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Fri, 26 Jan 2024 11:31:40 +0530 Subject: [PATCH 18/21] changed docker container name in workflows Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index eed2a8c28..a8fb535fa 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -7,7 +7,7 @@ git fetch origin git checkout native-linux # Start postgres instance. -docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d -e --name mypostgres POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh From dc9bfe313576e2a77106a5853887ffd349975fb5 Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Fri, 26 Jan 2024 11:37:10 +0530 Subject: [PATCH 19/21] changed docker container name in workflows Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index a8fb535fa..79ea92477 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -7,7 +7,7 @@ git fetch origin git checkout native-linux # Start postgres instance. -docker run -d -e --name mypostgres POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 +docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 --name mypostgres # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh From 53893acfcfd5b1402eceacb1d98e65c7b7a60c4a Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Fri, 26 Jan 2024 11:49:03 +0530 Subject: [PATCH 20/21] changed docker container name in workflows Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/java-linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_workflow_scripts/java-linux.sh b/.github/workflows/test_workflow_scripts/java-linux.sh index 79ea92477..5cc10f180 100644 --- a/.github/workflows/test_workflow_scripts/java-linux.sh +++ b/.github/workflows/test_workflow_scripts/java-linux.sh @@ -7,7 +7,7 @@ git fetch origin git checkout native-linux # Start postgres instance. -docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:15.2 --name mypostgres +docker run -d -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 --name mypostgres postgres:15.2 # Update the java version source ./../../../.github/workflows/test_workflow_scripts/update-java.sh From 148ae6110d4eca5f6c3bcb56682a21938daa5a9d Mon Sep 17 00:00:00 2001 From: EraKin575 Date: Sat, 27 Jan 2024 18:20:17 +0530 Subject: [PATCH 21/21] changed python workflow Signed-off-by: EraKin575 --- .github/workflows/test_workflow_scripts/python-linux.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_workflow_scripts/python-linux.sh b/.github/workflows/test_workflow_scripts/python-linux.sh index 785246401..79fa9bb0f 100644 --- a/.github/workflows/test_workflow_scripts/python-linux.sh +++ b/.github/workflows/test_workflow_scripts/python-linux.sh @@ -1,5 +1,7 @@ #! /bin/bash +source ./../../../.github/workflows/test_workflow_scripts/test-iid.sh + # Checkout a different branch git fetch origin git checkout native-linux