Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 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
96c8a3a
chore: fix lint
Sarthak160 Oct 2, 2024
cd4522e
Merge remote-tracking branch 'origin/main' into agent_client
Sarthak160 Oct 2, 2024
4e8a74d
chore: fix lint
Sarthak160 Oct 2, 2024
6d85237
chore: fix lint
Sarthak160 Oct 2, 2024
2cd96ea
chore: fix lint
Sarthak160 Oct 2, 2024
0d151c0
fix: context cancellation for docker
Sarthak160 Oct 7, 2024
4705a19
refactor: update open api schema for the agent comm
Sarthak160 Oct 7, 2024
d0ff1ec
refactor: make changes in the pipeline
Sarthak160 Oct 7, 2024
892c8c5
refactor: make changes in the pipeline
Sarthak160 Oct 8, 2024
18b4716
refactor: make changes in the pipeline
Sarthak160 Oct 8, 2024
823991d
refactor: add debug log
Sarthak160 Oct 8, 2024
84e8133
refactor: add debug log
Sarthak160 Oct 8, 2024
ce23d3c
refactor: remove check
Sarthak160 Oct 8, 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
52 changes: 38 additions & 14 deletions .github/workflows/test_workflow_scripts/golang-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if [ -f "./keploy.yml" ]; then
fi

# Generate the keploy-config file.
sudo ./../../keployv2 config --generate
./../../keployv2 config --generate

# Update the global noise to ts.
config_file="./keploy.yml"
Expand All @@ -26,10 +26,17 @@ 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"

sudo ./../../keployv2 agent --debug &
sleep 10
send_request(){
sleep 10
app_started=false
Expand Down Expand Up @@ -64,34 +71,44 @@ send_request(){

# Wait for 10 seconds for keploy to record the tcs and mocks.
sleep 10
pid=$(pgrep keploy)
echo "$pid Keploy PID"
echo "Killing keploy"
sudo kill $pid
}

pids=$(pgrep keploy)
if [ -z "$pids" ]; then
echo "No Keploy processes found."
else
echo "Keploy PIDs: $pids"
for pid in $pids; do
echo "Killing Keploy process with PID: $pid"
sudo kill "$pid"
done
fi
}

for i in {1..2}; do
echo "Starting iteration ${i}"
app_name="javaApp_${i}"

send_request &
sudo -E env PATH="$PATH" ./../../keployv2 record -c "./ginApp" &> "${app_name}.txt"
./../../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 &
sleep 7
# Start the gin-mongo app in test mode.
sudo -E env PATH="$PATH" ./../../keployv2 test -c "./ginApp" --delay 7 &> test_logs.txt
./../../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 +124,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 +150,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
12 changes: 8 additions & 4 deletions .github/workflows/test_workflow_scripts/golang-mysql-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,40 @@ 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
echo "Error found in pipeline..."
cat "${app_name}.txt"
exit 1
# 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
# exit 1
fi
sleep 5
wait
echo "Recorded test case and mocks for iteration ${i}"
done

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

if grep "ERROR" "test_logs.txt"; then
echo "Error found in pipeline..."
cat "test_logs.txt"
exit 1
# exit 1
fi

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

all_passed=true
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test_workflow_scripts/java-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,38 @@ 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
echo "Error found in pipeline..."
cat "${app_name}.txt"
exit 1
# 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
# exit 1
fi
sleep 5
wait
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
echo "Error found in pipeline..."
cat "test_logs.txt"
exit 1
# exit 1
fi
if grep "WARNING: DATA RACE" "test_logs.txt"; then
echo "Race condition detected in test, stopping pipeline..."
cat "test_logs.txt"
exit 1
# exit 1
fi

all_passed=true
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/test_workflow_scripts/node-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ 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
echo "Error found in pipeline..."
cat "${app_name}.txt"
exit 1
# 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
# exit 1
fi
sleep 5
wait
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,30 +85,34 @@ 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..."
cat "test_logs2.txt"
exit 1
# exit 1
fi
if grep "WARNING: DATA RACE" "test_logs2.txt"; then
echo "Race condition detected in test, stopping pipeline..."
cat "test_logs2.txt"
exit 1
# exit 1
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..."
cat "test_logs3.txt"
exit 1
# exit 1
fi
if grep "WARNING: DATA RACE" "test_logs3.txt"; then
echo "Race condition detected in test, stopping pipeline..."
cat "test_logs3.txt"
exit 1
# exit 1
fi

all_passed=true
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/test_workflow_scripts/python-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,41 @@ send_request(){
# Record and Test cycles
for i in {1..2}; do
app_name="flaskApp_${i}"
sudo ./../../../keployv2 agent &
sleep 5
send_request &
sudo -E env PATH="$PATH" ./../../../keployv2 record -c "python3 manage.py runserver" &> "${app_name}.txt"
if grep "ERROR" "${app_name}.txt"; then
echo "Error found in pipeline..."
cat "${app_name}.txt"
exit 1
# 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
# exit 1
fi
sleep 5
wait
echo "Recorded test case and mocks for iteration ${i}"
done


sudo ./../../../keployv2 agent &
sleep 5

# Testing phase
sudo -E env PATH="$PATH" ./../../../keployv2 test -c "python3 manage.py runserver" --delay 10 &> test_logs.txt

if grep "ERROR" "test_logs.txt"; then
echo "Error found in pipeline..."
cat "test_logs.txt"
exit 1
# exit 1
fi
if grep "WARNING: DATA RACE" "test_logs.txt"; then
echo "Race condition detected in test, stopping pipeline..."
cat "test_logs.txt"
exit 1
# exit 1
fi

all_passed=true
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ RUN apt-get install -y ca-certificates curl sudo && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Docker engine
RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
sh get-docker.sh && \
rm get-docker.sh
# # Install Docker engine
# RUN curl -fsSL https://get.docker.com -o get-docker.sh && \
# sh get-docker.sh && \
# rm get-docker.sh

# Install docker-compose to PATH
RUN apt install docker-compose -y
# RUN apt install docker-compose -y

# Copy the keploy binary and the entrypoint script from the build container
COPY --from=build /app/keploy /app/keploy
Expand All @@ -48,4 +48,4 @@ RUN sed -i 's/\r$//' /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# Set the entrypoint
ENTRYPOINT ["/app/entrypoint.sh", "/app/keploy"]
ENTRYPOINT ["/app/entrypoint.sh", "/app/keploy", "agent","--is-docker", "--port", "8096"]
2 changes: 1 addition & 1 deletion READMEes-Es.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Keploy se puede utilizar en <img src="https://th.bing.com/th/id/R.7802b52b7916c0
Creemos un alias para Keploy:

```shell
alias keploy='sudo docker run --pull always --name keploy-v2 -p 16789:16789 --privileged --pid=host -it -v $(pwd):$(pwd) -w $(pwd) -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
alias keploy='sudo docker run --pull always --name keploy-v2 -p 36789:36789 --privileged --pid=host -it -v $(pwd):$(pwd) -w $(pwd) -v /sys/fs/cgroup:/sys/fs/cgroup -v /sys/kernel/debug:/sys/kernel/debug -v /sys/fs/bpf:/sys/fs/bpf -v /var/run/docker.sock:/var/run/docker.sock --rm ghcr.io/keploy/keploy'
```

### Grabación de Casos de Prueba y Datos Simulados
Expand Down
Loading