Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ci tests to validate PR changes #1176

Merged
merged 168 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
884b813
feat: added ci pipelline for testing gin-mongo
PranshuSrivastava Nov 28, 2023
c49b29e
fix: updated location of the app
PranshuSrivastava Nov 28, 2023
318d334
fix: updated
PranshuSrivastava Nov 28, 2023
3afbf2f
fix: updated keploy location
PranshuSrivastava Nov 28, 2023
77c49bf
fix: updated test command
PranshuSrivastava Nov 28, 2023
30cba60
fix: updated keploy location
PranshuSrivastava Nov 28, 2023
b2ad73a
fix: updateed location
PranshuSrivastava Nov 28, 2023
b66e239
fix: removed eec
PranshuSrivastava Nov 28, 2023
6a2fc90
fix: updated the pid mechanism
PranshuSrivastava Nov 28, 2023
4a9a502
fix: updated kill mechanism]
PranshuSrivastava Nov 28, 2023
af5890f
fix: fixed sudo error
PranshuSrivastava Nov 28, 2023
d74d77a
feat: made async
PranshuSrivastava Nov 28, 2023
b0e1cb6
fix: increased wait time
PranshuSrivastava Nov 28, 2023
1d4146f
fix: added mongo
PranshuSrivastava Nov 28, 2023
7ca7df6
fix: removed keploy network
PranshuSrivastava Nov 28, 2023
603d4ec
fix: inc sleep time
PranshuSrivastava Nov 28, 2023
127f346
fix: changed the branch
PranshuSrivastava Nov 28, 2023
34712c6
fix: fixed branch issues
PranshuSrivastava Nov 28, 2023
d1e5203
fix: updated the time
PranshuSrivastava Nov 28, 2023
90640c7
fix: updated the tijme
PranshuSrivastava Nov 28, 2023
2d6452c
fix: checking if the application started or not
PranshuSrivastava Nov 28, 2023
4bbeea1
fix: added support for timestamp
PranshuSrivastava Nov 28, 2023
ffa8ffa
fix: fixed status
PranshuSrivastava Nov 28, 2023
55e2324
fix: removed echo
PranshuSrivastava Nov 28, 2023
a4ca604
feat: checking python workflow
PranshuSrivastava Nov 29, 2023
40c803b
fix: installed virtualenv before pushing
PranshuSrivastava Nov 29, 2023
c461a43
feat: added code to start keploy
PranshuSrivastava Nov 29, 2023
8bc93a5
fix: fixed sed
PranshuSrivastava Nov 29, 2023
e3afd8f
fix: fixed sed
PranshuSrivastava Nov 29, 2023
e3d2e86
fix: udpated keploy binary
PranshuSrivastava Nov 29, 2023
d41b9f3
fix: updated keploy location
PranshuSrivastava Nov 29, 2023
b63fc01
fix: updated the repo
PranshuSrivastava Nov 29, 2023
83c67d3
fix: added migrations
PranshuSrivastava Nov 29, 2023
95e5f00
fix: added sleep time
PranshuSrivastava Nov 29, 2023
dbc8abc
fix: updated back to keploy
PranshuSrivastava Nov 29, 2023
bfadca3
fix: removed virtualenv
PranshuSrivastava Nov 29, 2023
9c594f8
fix: check the containers
PranshuSrivastava Nov 29, 2023
6c4844e
fix: updated the config
PranshuSrivastava Nov 29, 2023
a16af28
fix: added back keploy
PranshuSrivastava Nov 30, 2023
db1eab6
fix: removed keploy
PranshuSrivastava Nov 30, 2023
2ea139f
fix: changed to fork
PranshuSrivastava Nov 30, 2023
67a24cc
fix: now checking the logs
PranshuSrivastava Nov 30, 2023
ada05eb
fix: checking on a diff portr
PranshuSrivastava Nov 30, 2023
3080578
fix: just checking the logs now
PranshuSrivastava Nov 30, 2023
b19b71f
fix: added keploy back
PranshuSrivastava Nov 30, 2023
b496110
fix: not checking the logs
PranshuSrivastava Nov 30, 2023
98d178d
fix: checking if something is running on the port or not
PranshuSrivastava Nov 30, 2023
010d6e1
fix: checking with telnet
PranshuSrivastava Nov 30, 2023
62d47ef
fix: s
PranshuSrivastava Nov 30, 2023
f5f3661
fix: somethign
PranshuSrivastava Nov 30, 2023
f0f5caa
fix: as
PranshuSrivastava Nov 30, 2023
3945716
fix: asd
PranshuSrivastava Nov 30, 2023
722342b
fix: asd
PranshuSrivastava Nov 30, 2023
c522ded
fix: updated endpoint
PranshuSrivastava Nov 30, 2023
5781a48
fix: removed telnet
PranshuSrivastava Nov 30, 2023
a9d8c37
fix: removed migrations
PranshuSrivastava Nov 30, 2023
1531754
fix: changed starting of databse
PranshuSrivastava Nov 30, 2023
2bcecb4
fix: starting the server again
PranshuSrivastava Nov 30, 2023
5d166da
fix: checking docker containers
PranshuSrivastava Nov 30, 2023
27ed681
fix: added back pid
PranshuSrivastava Nov 30, 2023
d8e6f0a
fix: added the logic for test
PranshuSrivastava Nov 30, 2023
82e1a3e
fix: added backward compatibility to the testcases
PranshuSrivastava Nov 30, 2023
6233a18
fix: removing keploy now
PranshuSrivastava Nov 30, 2023
72e08d2
feat: added pipeline for node
PranshuSrivastava Nov 30, 2023
7a3b749
fix: updated workflow file
PranshuSrivastava Nov 30, 2023
7ead3fd
fix: updated the docker container
PranshuSrivastava Nov 30, 2023
c3eba28
fix: updated
PranshuSrivastava Nov 30, 2023
e396cf3
feat: added java linux workflow
PranshuSrivastava Dec 1, 2023
b91393a
fix: updated location of the script
PranshuSrivastava Dec 1, 2023
8444811
fix: checking java version
PranshuSrivastava Dec 1, 2023
5086823
fix: updated java version
PranshuSrivastava Dec 1, 2023
3142c26
fix: updating apt
PranshuSrivastava Dec 1, 2023
d205297
fix: just checking the application
PranshuSrivastava Dec 1, 2023
2e8bd52
fix: checking the installed java versions
PranshuSrivastava Dec 1, 2023
46ea090
fix: checking the directories
PranshuSrivastava Dec 1, 2023
34b43da
fix: updated java version
PranshuSrivastava Dec 1, 2023
98665e6
fix: starting with keploy now
PranshuSrivastava Dec 1, 2023
bdb6eda
fix: updated keploy location
PranshuSrivastava Dec 1, 2023
6ced52d
fix: added 2 extra steps
PranshuSrivastava Dec 1, 2023
4afb922
fix: fixed indentation issues
PranshuSrivastava Dec 1, 2023
5c0152f
fix: updated the workflow
PranshuSrivastava Dec 1, 2023
4e3e9d5
fix: added update script
PranshuSrivastava Dec 1, 2023
5e5b57b
fix: updating the java version again
PranshuSrivastava Dec 1, 2023
14f4932
fix: added the code for keploy test mode as well
PranshuSrivastava Dec 1, 2023
0c18a71
fix: just confirming where we are
PranshuSrivastava Dec 1, 2023
ab738b0
fix: updated the location of the script
PranshuSrivastava Dec 1, 2023
ab997c6
fix: increased the delay
PranshuSrivastava Dec 1, 2023
6ae1029
fix: checking the testcases
PranshuSrivastava Dec 1, 2023
3fa2164
fix: fixed location
PranshuSrivastava Dec 1, 2023
03b407b
feat: added postgres
PranshuSrivastava Dec 4, 2023
e627649
fix: running in detached mode
PranshuSrivastava Dec 4, 2023
a3b1fc8
fix: running in detached mode
PranshuSrivastava Dec 4, 2023
ebdaaaf
feat: added java with docker
PranshuSrivastava Dec 4, 2023
6fb19f3
fix: changed to java docker
PranshuSrivastava Dec 4, 2023
1117e5a
fix: added code to expand aliases
PranshuSrivastava Dec 4, 2023
9826bad
fix: stopped using aliases
PranshuSrivastava Dec 4, 2023
383ea90
fix: removed keploy alias
PranshuSrivastava Dec 4, 2023
53b92ae
fix: starting keploy network
PranshuSrivastava Dec 4, 2023
1011649
fix: removed detached mode
PranshuSrivastava Dec 4, 2023
2286d68
fix: removed interactiveness of the shell
PranshuSrivastava Dec 4, 2023
a28e0da
fix: removed Home
PranshuSrivastava Dec 4, 2023
a304ab5
feat: added support for golang docker
PranshuSrivastava Dec 4, 2023
695a5d3
fix: removed using keplopy binary
PranshuSrivastava Dec 4, 2023
2127c1a
fix: updated the command to start the applciation
PranshuSrivastava Dec 4, 2023
8afebba
fix: checming
PranshuSrivastava Dec 4, 2023
151525d
fix: checking again
PranshuSrivastava Dec 4, 2023
780c283
fix: checking if the file already exists or not
PranshuSrivastava Dec 4, 2023
adc7f7f
fix: sending y
PranshuSrivastava Dec 4, 2023
a9fafa9
fix: removing keploy-config before
PranshuSrivastava Dec 4, 2023
3948b21
fix: not checking out to a diff branch
PranshuSrivastava Dec 4, 2023
8a7a333
Merge branch 'main' into ci-pipeline
PranshuSrivastava Dec 4, 2023
cf93a79
fix: checking again
PranshuSrivastava Dec 4, 2023
909461f
fix: building docker
PranshuSrivastava Dec 4, 2023
c33759d
fix: stopping keploy differently
PranshuSrivastava Dec 4, 2023
1125ca2
fix: fixed test mode
PranshuSrivastava Dec 4, 2023
ab49e29
fix: removing ginapp
PranshuSrivastava Dec 4, 2023
c44f14f
feat: added support for python docker
PranshuSrivastava Dec 4, 2023
cbec9e4
fix: removed it
PranshuSrivastava Dec 4, 2023
bb9da20
fix: specifying host
PranshuSrivastava Dec 5, 2023
2087e19
fix: checking logs
PranshuSrivastava Dec 5, 2023
b067ec3
fix: checking the logs again
PranshuSrivastava Dec 5, 2023
67916e8
fix: checking logs again
PranshuSrivastava Dec 5, 2023
3237035
fix: switched docker network
PranshuSrivastava Dec 5, 2023
75abffe
fix: not creating database
PranshuSrivastava Dec 5, 2023
ba76af6
fix: updated docker run command
PranshuSrivastava Dec 5, 2023
b27b333
fix: comment added
PranshuSrivastava Dec 5, 2023
fcb5d61
fix: removed migrations
PranshuSrivastava Dec 5, 2023
44d0f0e
fix: added initialisation script
PranshuSrivastava Dec 5, 2023
c5b4104
fix: made the path absolute
PranshuSrivastava Dec 5, 2023
0145fc3
fix: absolute path
PranshuSrivastava Dec 5, 2023
4690f57
fix: inspecting the network
PranshuSrivastava Dec 5, 2023
2b25448
fix: using docker ps
PranshuSrivastava Dec 5, 2023
881b243
fix: ps again
PranshuSrivastava Dec 5, 2023
b8ddca4
fix: checking logs
PranshuSrivastava Dec 5, 2023
5594103
fix: checkj
PranshuSrivastava Dec 5, 2023
0c05dda
fix: running detached again
PranshuSrivastava Dec 5, 2023
e620a5b
fix: fixed test
PranshuSrivastava Dec 5, 2023
cad8e13
fix: removing old keploy
PranshuSrivastava Dec 5, 2023
255af94
fix: stopping before removing
PranshuSrivastava Dec 5, 2023
69d61fe
fix: using rm -f
PranshuSrivastava Dec 5, 2023
1b8b53c
fix: checking again
PranshuSrivastava Dec 5, 2023
41ffda7
fix: inc delay
PranshuSrivastava Dec 5, 2023
7fd8f86
fix: added node docker
PranshuSrivastava Dec 5, 2023
5254142
fix: not using binary anymore
PranshuSrivastava Dec 5, 2023
2459286
fix: removing preexisting testcases
PranshuSrivastava Dec 5, 2023
3d9fb37
fix: inc the delay
PranshuSrivastava Dec 5, 2023
4ba5a95
fix: checking logs
PranshuSrivastava Dec 5, 2023
4009738
fix: check
PranshuSrivastava Dec 5, 2023
f106ff3
fix: check
PranshuSrivastava Dec 5, 2023
eac6b82
fix: check
PranshuSrivastava Dec 5, 2023
99e2458
fix: check
PranshuSrivastava Dec 5, 2023
88ed9f3
fix: only testing binaries
PranshuSrivastava Dec 5, 2023
86f5925
feat: added for loop
PranshuSrivastava Dec 5, 2023
621e927
fix: using binary now
PranshuSrivastava Dec 5, 2023
cc05b95
fix: checking both the results
PranshuSrivastava Dec 5, 2023
f37dfd0
fix: fixed
PranshuSrivastava Dec 5, 2023
efd1a36
fix: checking update
PranshuSrivastava Dec 5, 2023
3807064
fix: updated
PranshuSrivastava Dec 5, 2023
0255430
fix: reverted some changes
PranshuSrivastava Dec 5, 2023
bd72a98
fix: waiting before next iteration
PranshuSrivastava Dec 5, 2023
6455e43
fix: updated java
PranshuSrivastava Dec 6, 2023
d074e8c
fix: updated go branch
PranshuSrivastava Dec 6, 2023
6976f63
fix: fixed location of script
PranshuSrivastava Dec 6, 2023
da81702
fix: updated again
PranshuSrivastava Dec 6, 2023
305360d
Merge branch 'main' into ci-pipeline
gouravkrosx Dec 6, 2023
646304b
fix: updated python branch
PranshuSrivastava Dec 6, 2023
a367a51
Merge branch 'ci-pipeline' of https://github.com/PranshuSrivastava/ke…
PranshuSrivastava Dec 6, 2023
eac8265
fix: updated repo
PranshuSrivastava Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/golang-linux.sh
Original file line number Diff line number Diff line change
@@ -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/report-1.yaml"
test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}')
report_file2="./keploy/testReports/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
22 changes: 22 additions & 0 deletions .github/workflows/golang_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Golang On Linux
on: [pull_request]
jobs:
golang_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Build binary
run: |
go build -o keployv2
- name: Checkout the samples-go repository
uses: actions/checkout@v2
with:
repository: keploy/samples-go
path: samples-go
- name: Run samples-go application
run: |
cd samples-go/gin-mongo
source ./../../.github/workflows/golang-linux.sh

77 changes: 77 additions & 0 deletions .github/workflows/java-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#! /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/report-1.yaml"
test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}')
report_file2="./keploy/testReports/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
34 changes: 34 additions & 0 deletions .github/workflows/java_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Java on Linux
on: [pull_request]
jobs:
java_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Build Keploy binary
run: |
go build -o keployv2

- name: Checkout samples-java repository
uses: actions/checkout@v2
with:
repository: keploy/samples-java
path: samples-java

- name: Installing the necessary dependencies
run: |
cd samples-java/spring-petclinic/spring-petclinic-rest
./mvnw dependency:resolve

- name: Compile the project
run: |
cd samples-java/spring-petclinic/spring-petclinic-rest
source ./../../../.github/workflows/update-java.sh
./mvnw compile

- name: Run the spring-petclinic-rest app
run: |
cd samples-java/spring-petclinic/spring-petclinic-rest
source ./../../../.github/workflows/java-linux.sh
77 changes: 77 additions & 0 deletions .github/workflows/node-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#! /bin/bash

# Start the docker container.
sudo 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.
sudo rm -rf keploy/

for i in {1..2}; do
# Start keploy in record mode.
sudo -E env PATH=$PATH ./../../keployv2 record -c 'node src/app.js' &

# 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 'node src/app.js' --delay 10

# Get the test results from the testReport file.
report_file="./keploy/testReports/report-1.yaml"
test_status1=$(grep 'status:' "$report_file" | head -n 1 | awk '{print $2}')
report_file2="./keploy/testReports/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
23 changes: 23 additions & 0 deletions .github/workflows/node_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Node on Linux
on: [pull_request]
jobs:
node_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Build Keploy binary
run: |
go build -o keployv2

- name: Checkout samples-typescript repository
uses: actions/checkout@v2
with:
repository: keploy/samples-typescript
path: samples-typescript

- name: Run the express-mongoose app
run: |
cd samples-typescript/express-mongoose
source ./../../.github/workflows/node-linux.sh
Loading
Loading