Skip to content

Commit 5cd284c

Browse files
Achanandhi-MAchanandhiSonichigonehagup
authored andcommitted
chore: update GitLab CI/CD integration documentation (#511)
* fixed:flask-mongo-quickstart * chore: update flask mongo tests docs (#509) * fixed:flask-mongo-quickstart Signed-off-by: Achanandhi <[email protected]> * chore: update flask mongo test Signed-off-by: Achanandhi <[email protected]> Signed-off-by: Achanandhi <[email protected]> --------- Signed-off-by: Achanandhi <[email protected]> Signed-off-by: Achanandhi <[email protected]> Co-authored-by: Achanandhi <[email protected]> Co-authored-by: Animesh Pathak <[email protected]> * chore: update GitLab CI/CD integration and documentation Signed-off-by: Achanandhi <[email protected]> --------- Signed-off-by: Achanandhi <[email protected]> Signed-off-by: Achanandhi <[email protected]> Co-authored-by: Achanandhi <[email protected]> Co-authored-by: Animesh Pathak <[email protected]> Co-authored-by: Neha Gupta <[email protected]>
1 parent 658b8b7 commit 5cd284c

File tree

5 files changed

+88
-52
lines changed

5 files changed

+88
-52
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ npm start
160160
4. To reformat:
161161

162162
```sh
163-
npm prettier --write '**/*.{js,md}'
163+
npx prettier --write '**/*.{js,md}'
164164
```
165165

166166
5. Check the build status:

src/components/Community.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const Community = () => {
1010
Are you curious, 🤔 or do you have questions burning in your mind? 🔥
1111
Look no further! Join our lively Community Forum where you can:
1212
</p>
13-
<ul className="grid gap-6 sm:grid-cols-2 xl:gap-8 list-none">
13+
<ul className="grid list-none gap-6 sm:grid-cols-2 xl:gap-8">
1414
{/*<li>*/}
1515
{/* <a*/}
1616
{/* href="https://community.keploy.io/"*/}

src/pages/concepts/reference/glossary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function Glossary() {
156156
description="User General Information about Keploy's Documentation"
157157
>
158158
<main className="margin-vert--lg container flex flex-col justify-evenly">
159-
<div className="pb-5 text-center font-bold text-4xl">Glossary</div>
159+
<div className="pb-5 text-center text-4xl font-bold">Glossary</div>
160160
<div className="flex flex-row justify-evenly">
161161
{new Array(26).fill(0).map((x, i) => (
162162
<button

src/pages/privacy-policy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function PrivacyPolicy() {
1212
description="Privacy Policy information about Keploy."
1313
>
1414
<main className="margin-vert--lg container">
15-
<div className="pb-5 text-center font-bold text-4xl">
15+
<div className="pb-5 text-center text-4xl font-bold">
1616
Keploy Inc. Privacy Policy
1717
</div>
1818
<p className="text-2l md:text-3l mb-2 font-bold tracking-wide">

versioned_docs/version-2.0.0/ci-cd/gitlab.md

Lines changed: 84 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,60 @@ stages:
2626
- test
2727

2828
keploy-test-job: # This job runs in the test stage.
29-
image: ubuntu:latest
29+
image: ubuntu:22.04
3030
stage: test
3131
before_script:
32-
## Add the dependencies && Install Keploy Binary
33-
34-
- apt update && apt install -y sudo curl
35-
- curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_amd64.tar.gz" | tar xz --overwrite -C /tmp
36-
- sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin/keploy
37-
- sudo mount -t debugfs debugfs /sys/kernel/debug
32+
## Add the dependencies
33+
- apt-get update && apt-get install -y curl python3 python3-pip git kmod linux-headers-generic bpfcc-tools sudo
34+
- git clone https://github.com/keploy/samples-python
35+
- cd flask-mongo
36+
- mkdir -p /sys/kernel/debug
37+
- mkdir -p /sys/kernel/tracing
3838

3939
script:
40-
## Steps to run application
40+
## Steps to install Keploy and run application
4141
...
4242
```
4343

4444
> **Note: if you are using `arm_64` as runner use below to download keploy binary**
4545
4646
`curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz --overwrite -C /tmp`
4747

48-
Now that we have Keploy installed, and all ready, we need switch to path where `keploy` folder is present in our application and install all the application related dependencies. Since we are using [express-mongoose](https://github.com/keploy/samples-typescript/tree/main/express-mongoose) sample-application, steps in our `script:` would look like below:-
48+
Now that we have Keploy installed, and all ready, we need switch to path where `keploy` folder is present in our application and install all the application related dependencies. Since we are using [flask-mongo](https://github.com/keploy/samples-python) sample-application, steps in our `script:` would look like below:-
4949

5050
```yaml
5151
script:
52-
## Steps to run express-mongoose application
53-
- apt install -y nodejs npm
54-
- cd express-mongoose
55-
- npm install -y
56-
- keploy test -c "npm start"
52+
## Steps to install Keploy and run application
53+
# Install Keploy
54+
- curl --silent -O -L https://keploy.io/install.sh && source install.sh
55+
56+
# Mount required filesystems
57+
- mount -t debugfs nodev /sys/kernel/debug || true
58+
- mount -t tracefs nodev /sys/kernel/tracing || true
59+
60+
# Run Keploy tests
61+
- pip3 install -r requirements.txt
62+
- keploy test -c "python3 app.py" --delay 50
5763
```
5864
5965
In your `.gitlab-ci.yml file`, in last step we have `keploy test` command to run your keploy generated test suite, this sets up Keploy to replay the interactions it has generated and perform CI Testing.
6066

67+
### 📝 Note
68+
69+
Did you notice some weird stuff in the pipeline? Like `kmod`, `linux-headers`, `/sys/kernel/debug`...and thought, _"Wait, am I hacking the kernel or something?"_ 😅
70+
71+
Don’t worry — these are just there because **Keploy uses eBPF** (a cool Linux feature) to trace your app’s behavior.
72+
73+
So we install `kmod`, `linux-headers-generic`, and `bpfcc-tools` to make that tracing possible.
74+
75+
Some CI systems don’t have `/sys/kernel/debug` and `/sys/kernel/tracing` by default, so we create them and mount `debugfs` and `tracefs` — it’s like giving Keploy the **backstage pass** it needs to watch your app in action.
76+
77+
No black magic. Just some low-level Linux stuff helping your tests run like magic! 🪄✨
78+
6179
We will get to see output : -
6280

6381
```sh
64-
$ keploy test -c "npm start"
82+
$ keploy test -c "python3 app.py" --delay 50
6583
▓██▓▄
6684
▓▓▓▓██▓█▓▄
6785
████████▓▒
@@ -71,46 +89,64 @@ $ keploy test -c "npm start"
7189
▓▓▓▓▀▀▀▀▓▓▓▓▓▓▌ ██ █▓ ▓▌▄▄ ▐█▓▄▓█▀ █▓█ ▀█▄▄█▀ █▓█
7290
▓▌ ▐█▌ █▌
7391
92+
version: 2.5.1
93+
🐰 Keploy: 2025-04-14T16:22:12Z WARN python language detected. please use --language to manually set the language if needed
94+
🐰 Keploy: 2025-04-14T16:22:13Z INFO keploy initialized and probes added to the kernel.
95+
🐰 Keploy: 2025-04-14T16:22:14Z INFO starting UDP DNS server at addr :26789
96+
🐰 Keploy: 2025-04-14T16:22:14Z INFO Keploy has taken control of the DNS resolution mechanism, your application may misbehave if you have provided wrong domain name in your application code.
97+
🐰 Keploy: 2025-04-14T16:22:14Z INFO Proxy started at port:16789
98+
🐰 Keploy: 2025-04-14T16:22:14Z INFO running {"test-set": "[test-set-0]"}
99+
🐰 Keploy: 2025-04-14T16:22:14Z INFO starting TCP DNS server at addr :26789
100+
* Serving Flask app 'app'
101+
* Debug mode: on
102+
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
103+
* Running on all addresses (0.0.0.0)
104+
* Running on http://127.0.0.1:6000
105+
* Running on http://127.0.0.1:6000
106+
Press CTRL+C to quit
107+
* Restarting with stat
108+
* Debugger is active!
109+
* Debugger PIN: 100-754-563
110+
🐰 Keploy: 2025-04-14T16:23:04Z INFO starting test for of {"test case": "[test-1]", "test set": "[test-set-0]"}
111+
127.0.0.1 - - [14/Apr/2025 16:23:04] "POST /students HTTP/1.1" 200 -
112+
Testrun passed for testcase with id: "test-1"
113+
--------------------------------------------------------------------
114+
🐰 Keploy: 2025-04-14T16:23:04Z INFO result {"testcase id": "[test-1]", "testset id": "[test-set-0]", "passed": "[true]"}
115+
<=========================================>
116+
TESTRUN SUMMARY. For test-set: "test-set-0"
117+
Total tests: 1
118+
Total test passed: 1
119+
Total test failed: 0
120+
Time Taken: "50.01 s"
121+
<=========================================>
122+
COMPLETE TESTRUN SUMMARY.
123+
Total tests: 1
124+
Total test passed: 1
125+
Total test failed: 0
126+
Total time taken: "50.01 s"
127+
Test Suite Name Total Test Passed Failed Time Taken
128+
"test-set-0" 1 1 0 "50.01 s"
129+
<=========================================>
130+
🐰 Keploy: 2025-04-14T16:23:05Z INFO calculating coverage for the test run and inserting it into the report
131+
Wrote JSON report to coverage.json
132+
🐰 Keploy: 2025-04-14T16:23:05Z INFO [Total Coverage Percentage: 64%]
133+
🐰 Keploy: 2025-04-14T16:23:05Z INFO stopping Keploy {"reason": "replay completed successfully"}
134+
🐰 Keploy: 2025-04-14T16:23:05Z INFO proxy stopped...
135+
🐰 Keploy: 2025-04-14T16:23:05Z INFO eBPF resources released successfully...
136+
Cleaning up project directory and file based variables
137+
00:00
138+
Job succeeded
74139
75-
version: 2.1.0-alpha23
76-
77-
🐰 Keploy: 2024-06-05T06:32:52Z INFO config file not found; proceeding with flags only
78-
🐰 Keploy: 2024-06-05T06:32:52Z WARN Delay is set to 5 seconds, incase your app takes more time to start use --delay to set custom delay
79-
🐰 Keploy: 2024-06-05T06:32:52Z INFO Example usage: keploy test -c "/path/to/user/app" --delay 6
80-
🐰 Keploy: 2024-06-05T06:32:52Z INFO GitHub Actions workflow file generated successfully {"path": "/githubactions/keploy.yml"}
81-
🐰 Keploy: 2024-06-05T06:32:53Z INFO keploy initialized and probes added to the kernel.
82-
🐰 Keploy: 2024-06-05T06:32:54Z INFO Keploy has taken control of the DNS resolution mechanism, your application may misbehave if you have provided wrong domain name in your application code.
83-
🐰 Keploy: 2024-06-05T06:32:54Z INFO starting TCP DNS server at addr :26789
84-
🐰 Keploy: 2024-06-05T06:32:54Z INFO Proxy started at port:16789
85-
🐰 Keploy: 2024-06-05T06:32:54Z INFO running {"test-set": "test-set-0"}
86-
🐰 Keploy: 2024-06-05T06:32:54Z INFO starting UDP DNS server at addr :26789
87-
88-
89-
> node src/app.js
90-
91-
Listening on port 8000
92-
Connected to MongoDB
93-
🐰 Keploy: 2024-06-05T06:32:59Z INFO starting test for of {"test case": "test-1", "test set": "test-set-0"}
94-
Testrun passed for testcase with id: "test-1"
95-
96-
--------------------------------------------------------------------
97-
98-
🐰 Keploy: 2024-06-05T06:32:54Z INFO result {"testcase id": "test-1", "testset id": "test-set-0", "passed": "true"}
99-
100-
<=========================================>
101-
TESTRUN SUMMARY. For test-set: "test-set-0"
102-
Total tests: 1
103-
Total test passed: 1
104-
Total test failed: 0
105-
<=========================================>
106-
...
107-
🐰 Keploy: 2024-06-05T06:32:54Z INFO test run completed {"passed overall": true}
108140
```
109141

110142
_And... voila! You have successfully integrated keploy in GitLab CI/CD pipeline 🌟_
111143

112144
Integrating Keploy with GitLab CI automates the testing process, ensuring that tests are run with every commit and merge request. And by running tests automatically in CI pipeline, you can catch issues early and ensure that your application remains stable and reliable.
113145

146+
### 📦 Need the Full Pipeline?
147+
148+
If you’re thinking, “This pipeline looks cool, but I need the _whole thing_ to integrate with your application!” — well, you're in luck! Check it out [here](https://github.com/keploy/samples-python) and get ready to copy-paste your way to success! ✨🚀
149+
114150
Hope this helps you out, if you still have any questions, reach out to us .
115151

116152
import GetSupport from '../concepts/support.md'

0 commit comments

Comments
 (0)