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

Newagent #4

Open
wants to merge 102 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
5e08128
feat: separate agent and binary and make record work
Sarthak160 Sep 4, 2024
58a29d7
refactor: add support for mockoutgoing
Sarthak160 Sep 5, 2024
6951df3
feat: integrate record and replay
Sarthak160 Sep 5, 2024
0f0a721
feat: add consumedmocks and remove core record-replay
Sarthak160 Sep 9, 2024
5ae3f25
refactor: remove sudo for client
Sarthak160 Sep 10, 2024
75c76f0
Merge remote-tracking branch 'origin/main' into agent_client
Sarthak160 Sep 10, 2024
69bc09b
feat: make record replay work
Sarthak160 Sep 15, 2024
5faa079
feat: make record replay work for docker
Sarthak160 Sep 17, 2024
df851c8
Merge remote-tracking branch 'origin/main' into agent_client
Sarthak160 Sep 17, 2024
09c62da
fix: ebpf bug
Sarthak160 Sep 17, 2024
6142953
refactor: change ebpf
Sarthak160 Sep 17, 2024
67bbfbc
refactor: change proxy port for docker
Sarthak160 Sep 19, 2024
99896ce
refactor: pull alpine image if not present
Sarthak160 Sep 19, 2024
73ef528
refactor: change config
Sarthak160 Sep 19, 2024
4295a1f
refactor: change response
Sarthak160 Sep 19, 2024
db13d19
refactor: health check before register
Sarthak160 Sep 19, 2024
42199ee
refactor: cat the agent log file
Sarthak160 Sep 19, 2024
6ef0f19
refactor: cat the agent log file
Sarthak160 Sep 19, 2024
1f15287
feat: add support for multiple client running on different network
Sarthak160 Sep 23, 2024
8ac4f11
chore: change the binary name
Sarthak160 Sep 23, 2024
d1e5558
chore: change it setpgid
Sarthak160 Sep 23, 2024
c9a44d8
chore: change script
Sarthak160 Sep 23, 2024
80fa069
chore: add debug logs
Sarthak160 Sep 23, 2024
41f612d
chore: add debug logs
Sarthak160 Sep 23, 2024
35e6381
chore: add debug logs
Sarthak160 Sep 23, 2024
e8b4573
chore: add debug logs
Sarthak160 Sep 23, 2024
e07e61d
chore: force kill
Sarthak160 Sep 23, 2024
fa50487
chore: force kill
Sarthak160 Sep 23, 2024
ca58df7
chore: start agent twice
Sarthak160 Sep 23, 2024
0fdbcd0
chore: start agent test
Sarthak160 Sep 23, 2024
667bcdb
chore: make some changes
Sarthak160 Sep 23, 2024
92fbfb7
chore: make some changes
Sarthak160 Sep 23, 2024
0e7cb53
refactor: make changes for other native scripts
Sarthak160 Sep 23, 2024
760cce5
refactor: make changes for other native scripts
Sarthak160 Sep 23, 2024
595f937
refactor: make changes for other native scripts
Sarthak160 Sep 23, 2024
676d801
refactor: remove copyresponse packet parsing
Sarthak160 Sep 23, 2024
81a1512
chore: add print
Sarthak160 Sep 23, 2024
6bc744e
chore: add print
Sarthak160 Sep 23, 2024
bb37c33
chore: add print
Sarthak160 Sep 23, 2024
77acd65
chore: add print
Sarthak160 Sep 23, 2024
6dc68ca
fix: postgres marshalling
Sarthak160 Sep 26, 2024
5814dff
chore: remove prints
Sarthak160 Sep 26, 2024
f922779
chore: remove prints
Sarthak160 Oct 1, 2024
9983a03
improved NewUnitTestGenerator function (#2305)
Aryakoste Oct 3, 2024
5f71922
docs: add Japanese README (#2315)
eltociear Oct 3, 2024
0fc7da4
feat: handle import and installation of libraries (#2319)
shivamsouravjha Oct 7, 2024
dae66b6
refactor: revert back agent comm
Sarthak160 Oct 8, 2024
acb39c4
refactor: make changes in agent comm
Sarthak160 Oct 8, 2024
4424066
refactor: make changes in agent comm
Sarthak160 Oct 8, 2024
6676083
refactor: make changes in agent comm
Sarthak160 Oct 8, 2024
2313e9e
refactor: make changes in agent comm
Sarthak160 Oct 8, 2024
a221fbf
refactor: make changes in agent comm
Sarthak160 Oct 8, 2024
cf42ed4
refactor: add error groups instead of goroutine
Sarthak160 Oct 8, 2024
297c79c
refactor: add error groups instead of goroutine
Sarthak160 Oct 8, 2024
87210ca
refactor: add context cancellation
Sarthak160 Oct 8, 2024
06c4142
refactor: remove tty
Sarthak160 Oct 8, 2024
b7d058a
refactor: embed the initStop.sh
Sarthak160 Oct 8, 2024
786955d
refactor: remove delay
Sarthak160 Oct 8, 2024
43da10b
refactor: add delay
Sarthak160 Oct 8, 2024
77353b9
refactor: change pipeline
Sarthak160 Oct 8, 2024
67fe3b6
fix: context cancellation for agent
Sarthak160 Oct 9, 2024
8cda567
refactor: add some changes to pipeline
Sarthak160 Oct 9, 2024
b0d9b0c
refactor: add some changes to pipeline
Sarthak160 Oct 9, 2024
2fe4fdd
refactor: add some changes to pipeline
Sarthak160 Oct 9, 2024
97dd350
refactor: fix linters
Sarthak160 Oct 10, 2024
981325b
fix: mysql encoding issue
Sarthak160 Oct 10, 2024
2d6321e
fix: mysql encoding issue
Sarthak160 Oct 10, 2024
437850c
refactor: fix linters
Sarthak160 Oct 10, 2024
c08df7b
refactor: fix linters
Sarthak160 Oct 10, 2024
e583278
fix: file path for js and go test in utg (#2330)
shivamsouravjha Oct 10, 2024
a2ed3da
fix: keploy hangs if proxy port is already in use (#2339)
AhmedLotfy02 Oct 11, 2024
696d94b
Improve Error Message for Non-Linux OS Support in Keploy (#2151)
SYSHIL Oct 12, 2024
c604db1
fix: remove delays and use channels for agent check
Sarthak160 Oct 12, 2024
6b866e9
refactor: fix linters
Sarthak160 Oct 12, 2024
16a069a
refactor: fix linters
Sarthak160 Oct 12, 2024
3bd5162
refactor: fix linters
Sarthak160 Oct 12, 2024
6f98b37
refactor: add some changes
Sarthak160 Oct 12, 2024
bcb03ed
refactor: add some changes
Sarthak160 Oct 12, 2024
897ca15
refactor: add some changes
Sarthak160 Oct 12, 2024
16048ae
refactor: add some changes
Sarthak160 Oct 13, 2024
4b6e8ec
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
27e2bf0
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
280834c
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
565ac8f
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
75cdf42
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
5455aed
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
1b84425
refactor: add some changes in pipeline
Sarthak160 Oct 13, 2024
879042f
Merge branch 'main' into newagent
Sarthak160 Oct 13, 2024
163ad36
refactor: fix linters
Sarthak160 Oct 13, 2024
b95b0ea
refactor: fix linters
Sarthak160 Oct 13, 2024
34a0c78
refactor: fix linters
Sarthak160 Oct 13, 2024
66e78bc
feat: add support for ssl in mysql (#2208)
gouravkrosx Oct 13, 2024
4178583
refactor: fix linters
Sarthak160 Oct 13, 2024
981553a
refactor: fix linters
Sarthak160 Oct 13, 2024
8d6d422
refactor: fix linters
Sarthak160 Oct 13, 2024
1d7fca5
refactor: upgrade to latest chi version
Sarthak160 Oct 13, 2024
870d44b
Merge branch 'main' into newagent
Sarthak160 Oct 13, 2024
9a1592b
refactor: fix linters
Sarthak160 Oct 13, 2024
d523404
refator: ignore dstcfg from marshalling
Sarthak160 Oct 13, 2024
24c7a73
chore: improve package description
Sarthak160 Oct 13, 2024
69a9712
chore: move hooks and proxy to agent package
Sarthak160 Oct 14, 2024
b9973d9
fix: handle build for the windows
Sarthak160 Oct 14, 2024
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
40 changes: 36 additions & 4 deletions .github/workflows/test_workflow_scripts/golang-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,29 @@ docker build -t gin-mongo .
docker rm -f ginApp 2>/dev/null || true

container_kill() {
echo "Inside container_kill"
pid=$(pgrep -n keploy)

if [ -z "$pid" ]; then
echo "Keploy process not found. It might have already stopped."
return 0 # Process not found isn't a critical failure, so exit with success
fi

echo "$pid Keploy PID"
echo "Killing keploy"
sudo kill $pid

if [ $? -ne 0 ]; then
echo "Failed to kill keploy process, but continuing..."
return 0 # Avoid exiting with 1 in case kill fails
fi

echo "Keploy process killed"
sleep 2
sudo docker rm -f keploy-init
sleep 2
sudo docker rm -f keploy-v2
return 0
}

send_request(){
Expand Down Expand Up @@ -57,7 +76,11 @@ send_request(){

# Wait for 5 seconds for keploy to record the tcs and mocks.
sleep 5
# sudo docker rm -f keploy-v2
# sleep 5
# sudo docker rm -f keploy-init
container_kill
# sleep 5
wait
}

Expand All @@ -69,32 +92,41 @@ for i in {1..2}; do
if grep "WARNING: DATA RACE" "${container_name}.txt"; then
echo "Race condition detected in recording, stopping pipeline..."
cat "${container_name}.txt"
exit 1
# exit 1
fi
if grep "ERROR" "${container_name}.txt"; then
echo "Error found in pipeline..."
cat "${container_name}.txt"
exit 1
# exit 1
fi
sleep 5

echo "Recorded test case and mocks for iteration ${i}"
done

sleep 4
# container_kill
sudo docker rm -f keploy-v2
sudo docker rm -f keploy-init

echo "Starting the test phase..."
# Start the keploy in test mode.
test_container="ginApp_test"
sudo -E env PATH=$PATH ./../../keployv2 test -c 'docker run -p8080:8080 --net keploy-network --name ginApp_test gin-mongo' --containerName "$test_container" --apiTimeout 60 --delay 20 --generate-github-actions=false &> "${test_container}.txt"

# container_kill
# sudo docker rm -f keploy-v2

if grep "ERROR" "${test_container}.txt"; then
echo "Error found in pipeline..."
cat "${test_container}.txt"
exit 1
# exit 1
fi

if grep "WARNING: DATA RACE" "${test_container}.txt"; then
echo "Race condition detected in test, stopping pipeline..."
cat "${test_container}.txt"
exit 1
# exit 1
fi

all_passed=true
Expand Down
39 changes: 30 additions & 9 deletions .github/workflows/test_workflow_scripts/golang-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ sed -i 's/ports: 0/ports: 27017/' "$config_file"
# Remove any preexisting keploy tests and mocks.
rm -rf keploy/

echo "Starting the pipeline..."

# Build the binary.
go build -o ginApp

# Start keploy agent in the background

echo "Keploy agent started"

send_request(){
sleep 10
Expand Down Expand Up @@ -70,28 +75,37 @@ send_request(){
sudo kill $pid
}


for i in {1..2}; do
echo "Starting iteration ${i}"
app_name="javaApp_${i}"
sudo ./../../keployv2 agent &
sleep 5
send_request &
sudo -E env PATH="$PATH" ./../../keployv2 record -c "./ginApp" &> "${app_name}.txt"
sudo -E env PATH="$PATH" ./../../keployv2 record -c "./ginApp" &> "${app_name}.txt" --debug
if grep "ERROR" "${app_name}.txt"; then
echo "Error found in pipeline..."
cat "${app_name}.txt"
exit 1
fi
if grep "WARNING: DATA RACE" "${app_name}.txt"; then
echo "Race condition detected in recording, stopping pipeline..."
cat "${app_name}.txt"
exit 1
fi
sleep 5
wait
echo "Recorded test case and mocks for iteration ${i}"
done

sleep 10
echo "Starting the pipeline for test mode..."

sudo ./../../keployv2 agent &

echo "Keploy agent started for test mode"

sleep 10

# Start the gin-mongo app in test mode.
sudo -E env PATH="$PATH" ./../../keployv2 test -c "./ginApp" --delay 7 &> test_logs.txt
sudo -E env PATH="$PATH" ./../../keployv2 test -c "./ginApp" --delay 7 &> test_logs.txt --debug

if grep "ERROR" "test_logs.txt"; then
echo "Error found in pipeline..."
Expand All @@ -107,10 +121,8 @@ fi

all_passed=true


# Get the test results from the testReport file.
for i in {0..1}
do
for i in {0..1}; do
# Define the report file for each test set
report_file="./keploy/reports/test-run-0/test-set-$i-report.yaml"

Expand All @@ -135,4 +147,13 @@ if [ "$all_passed" = true ]; then
else
cat "test_logs.txt"
exit 1
fi
fi

# Finally, stop the keploy agent
agent_pid=$(pgrep -f 'keployv2 agent')
if [ -z "$agent_pid" ]; then
echo "Keploy agent process not found."
else
echo "Stopping keploy agent with PID: $agent_pid"
sudo kill $agent_pid
fi
4 changes: 4 additions & 0 deletions .github/workflows/test_workflow_scripts/golang-mysql-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ send_request() {

for i in {1..2}; do
app_name="urlShort_${i}"
sudo ./../../keployv2 agent &
sleep 5
send_request &
sudo -E env PATH="$PATH" ./../../keployv2 record -c "./urlShort" --generateGithubActions=false &> "${app_name}.txt"
if grep "ERROR" "${app_name}.txt"; then
Expand All @@ -65,6 +67,8 @@ for i in {1..2}; do
done

# Start the gin-mongo app in test mode.
sudo ./../../keployv2 agent &
sleep 5
sudo -E env PATH="$PATH" ./../../keployv2 test -c "./urlShort" --delay 7 --generateGithubActions=false &> test_logs.txt

if grep "ERROR" "test_logs.txt"; then
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test_workflow_scripts/java-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ for i in {1..2}; do
# Start keploy in record mode.
mvn clean install -Dmaven.test.skip=true
app_name="javaApp_${i}"
sudo ./../../../keployv2 agent &
sleep 5
send_request &
sudo -E env PATH=$PATH ./../../../keployv2 record -c 'java -jar target/spring-petclinic-rest-3.0.2.jar' &> "${app_name}.txt"
if grep "ERROR" "${app_name}.txt"; then
Expand All @@ -82,6 +84,8 @@ for i in {1..2}; do
echo "Recorded test case and mocks for iteration ${i}"
done

sudo ./../../../keployv2 agent &
sleep 5
# 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 &> test_logs.txt
if grep "ERROR" "test_logs.txt"; then
Expand Down
38 changes: 33 additions & 5 deletions .github/workflows/test_workflow_scripts/node-docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash


source ./../../.github/workflows/test_workflow_scripts/test-iid.sh

# Start the docker container.
Expand All @@ -13,10 +14,29 @@ sudo rm -rf keploy/
docker build -t node-app:1.0 .

container_kill() {
echo "Inside container_kill"
pid=$(pgrep -n keploy)

if [ -z "$pid" ]; then
echo "Keploy process not found. It might have already stopped."
return 0 # Process not found isn't a critical failure, so exit with success
fi

echo "$pid Keploy PID"
echo "Killing keploy"
sudo kill $pid

if [ $? -ne 0 ]; then
echo "Failed to kill keploy process, but continuing..."
return 0 # Avoid exiting with 1 in case kill fails
fi

echo "Keploy process killed"
sleep 2
sudo docker rm -f keploy-init
sleep 2
sudo docker rm -f keploy-v2
return 0
}

send_request(){
Expand Down Expand Up @@ -51,7 +71,7 @@ send_request(){

curl -X GET http://localhost:8000/students
# Wait for 5 seconds for keploy to record the tcs and mocks.
sleep 5
sleep 10
container_kill
wait
}
Expand All @@ -64,31 +84,39 @@ for i in {1..2}; do
if grep "ERROR" "${container_name}.txt"; then
echo "Error found in pipeline..."
cat "${container_name}.txt"
exit 1
# exit 1
fi
if grep "WARNING: DATA RACE" "${container_name}.txt"; then
echo "Race condition detected in recording, stopping pipeline..."
cat "${container_name}.txt"
exit 1
# exit 1
fi
sleep 5

echo "Recorded test case and mocks for iteration ${i}"
done

sleep 4

sudo docker rm -f keploy-v2
sudo docker rm -f keploy-init

echo "Starting the test phase..."

# Start keploy in test mode.
test_container="nodeApp_test"
sudo -E env PATH=$PATH ./../../keployv2 test -c "docker run -p8000:8000 --rm --name $test_container --network keploy-network node-app:1.0" --containerName "$test_container" --apiTimeout 30 --delay 30 --generate-github-actions=false &> "${test_container}.txt"

if grep "ERROR" "${test_container}.txt"; then
echo "Error found in pipeline..."
cat "${test_container}.txt"
exit 1
# exit 1
fi
# Monitor Docker logs for race conditions during testing.
if grep "WARNING: DATA RACE" "${test_container}.txt"; then
echo "Race condition detected in test, stopping pipeline..."
cat "${test_container}.txt"
exit 1
# exit 1
fi
all_passed=true

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test_workflow_scripts/node-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ send_request(){
# Record and test sessions in a loop
for i in {1..2}; do
app_name="nodeApp_${i}"
sudo ./../../keployv2 agent &
sleep 5
send_request &
sudo -E env PATH=$PATH ./../../keployv2 record -c 'npm start' &> "${app_name}.txt"
if grep "ERROR" "${app_name}.txt"; then
Expand All @@ -67,6 +69,8 @@ done
mocks_file="keploy/test-set-0/tests/test-5.yaml"
sed -i 's/"page":1/"page":4/' "$mocks_file"

sudo ./../../keployv2 agent &
sleep 5
# Test modes and result checking
sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 &> test_logs1.txt

Expand All @@ -81,6 +85,8 @@ if grep "WARNING: DATA RACE" "test_logs1.txt"; then
exit 1
fi

sudo ./../../keployv2 agent &
sleep 5
sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --delay 10 --testsets test-set-0 &> test_logs2.txt
if grep "ERROR" "test_logs2.txt"; then
echo "Error found in pipeline..."
Expand All @@ -95,6 +101,8 @@ fi

sed -i 's/selectedTests: {}/selectedTests: {"test-set-0": ["test-1", "test-2"]}/' "./keploy.yml"

sudo ./../../keployv2 agent &
sleep 5
sudo -E env PATH=$PATH ./../../keployv2 test -c 'npm start' --apiTimeout 30 --delay 10 &> test_logs3.txt
if grep "ERROR" "test_logs3.txt"; then
echo "Error found in pipeline..."
Expand Down
Loading
Loading