+
Keploy Inc. Privacy Policy
diff --git a/versioned_docs/version-2.0.0/ci-cd/gitlab.md b/versioned_docs/version-2.0.0/ci-cd/gitlab.md
index 6cf017cea..c9d836b51 100644
--- a/versioned_docs/version-2.0.0/ci-cd/gitlab.md
+++ b/versioned_docs/version-2.0.0/ci-cd/gitlab.md
@@ -26,18 +26,18 @@ stages:
- test
keploy-test-job: # This job runs in the test stage.
- image: ubuntu:latest
+ image: ubuntu:22.04
stage: test
before_script:
- ## Add the dependencies && Install Keploy Binary
-
- - apt update && apt install -y sudo curl
- - curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_amd64.tar.gz" | tar xz --overwrite -C /tmp
- - sudo mkdir -p /usr/local/bin && sudo mv /tmp/keploy /usr/local/bin/keploy
- - sudo mount -t debugfs debugfs /sys/kernel/debug
+ ## Add the dependencies
+ - apt-get update && apt-get install -y curl python3 python3-pip git kmod linux-headers-generic bpfcc-tools sudo
+ - git clone https://github.com/keploy/samples-python
+ - cd flask-mongo
+ - mkdir -p /sys/kernel/debug
+ - mkdir -p /sys/kernel/tracing
script:
- ## Steps to run application
+ ## Steps to install Keploy and run application
...
```
@@ -45,23 +45,41 @@ keploy-test-job: # This job runs in the test stage.
`curl --silent --location "https://github.com/keploy/keploy/releases/latest/download/keploy_linux_arm64.tar.gz" | tar xz --overwrite -C /tmp`
-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:-
+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:-
```yaml
script:
- ## Steps to run express-mongoose application
- - apt install -y nodejs npm
- - cd express-mongoose
- - npm install -y
- - keploy test -c "npm start"
+ ## Steps to install Keploy and run application
+ # Install Keploy
+ - curl --silent -O -L https://keploy.io/install.sh && source install.sh
+
+ # Mount required filesystems
+ - mount -t debugfs nodev /sys/kernel/debug || true
+ - mount -t tracefs nodev /sys/kernel/tracing || true
+
+ # Run Keploy tests
+ - pip3 install -r requirements.txt
+ - keploy test -c "python3 app.py" --delay 50
```
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.
+### π Note
+
+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?"_ π
+
+Donβt worry β these are just there because **Keploy uses eBPF** (a cool Linux feature) to trace your appβs behavior.
+
+So we install `kmod`, `linux-headers-generic`, and `bpfcc-tools` to make that tracing possible.
+
+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.
+
+No black magic. Just some low-level Linux stuff helping your tests run like magic! πͺβ¨
+
We will get to see output : -
```sh
-$ keploy test -c "npm start"
+$ keploy test -c "python3 app.py" --delay 50
βββββ
ββββββββββ
ββββββββββ
@@ -71,46 +89,64 @@ $ keploy test -c "npm start"
βββββββββββββββ ββ ββ ββββ βββββββ βββ ββββββ βββ
ββ βββ ββ
β
+version: 2.5.1
+π° Keploy: 2025-04-14T16:22:12Z WARN python language detected. please use --language to manually set the language if needed
+π° Keploy: 2025-04-14T16:22:13Z INFO keploy initialized and probes added to the kernel.
+π° Keploy: 2025-04-14T16:22:14Z INFO starting UDP DNS server at addr :26789
+π° 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.
+π° Keploy: 2025-04-14T16:22:14Z INFO Proxy started at port:16789
+π° Keploy: 2025-04-14T16:22:14Z INFO running {"test-set": "[test-set-0]"}
+π° Keploy: 2025-04-14T16:22:14Z INFO starting TCP DNS server at addr :26789
+ * Serving Flask app 'app'
+ * Debug mode: on
+WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
+ * Running on all addresses (0.0.0.0)
+ * Running on http://127.0.0.1:6000
+ * Running on http://127.0.0.1:6000
+Press CTRL+C to quit
+ * Restarting with stat
+ * Debugger is active!
+ * Debugger PIN: 100-754-563
+π° Keploy: 2025-04-14T16:23:04Z INFO starting test for of {"test case": "[test-1]", "test set": "[test-set-0]"}
+127.0.0.1 - - [14/Apr/2025 16:23:04] "POST /students HTTP/1.1" 200 -
+Testrun passed for testcase with id: "test-1"
+--------------------------------------------------------------------
+π° Keploy: 2025-04-14T16:23:04Z INFO result {"testcase id": "[test-1]", "testset id": "[test-set-0]", "passed": "[true]"}
+ <=========================================>
+ TESTRUN SUMMARY. For test-set: "test-set-0"
+ Total tests: 1
+ Total test passed: 1
+ Total test failed: 0
+ Time Taken: "50.01 s"
+ <=========================================>
+ COMPLETE TESTRUN SUMMARY.
+ Total tests: 1
+ Total test passed: 1
+ Total test failed: 0
+ Total time taken: "50.01 s"
+ Test Suite Name Total Test Passed Failed Time Taken
+ "test-set-0" 1 1 0 "50.01 s"
+<=========================================>
+π° Keploy: 2025-04-14T16:23:05Z INFO calculating coverage for the test run and inserting it into the report
+Wrote JSON report to coverage.json
+π° Keploy: 2025-04-14T16:23:05Z INFO [Total Coverage Percentage: 64%]
+π° Keploy: 2025-04-14T16:23:05Z INFO stopping Keploy {"reason": "replay completed successfully"}
+π° Keploy: 2025-04-14T16:23:05Z INFO proxy stopped...
+π° Keploy: 2025-04-14T16:23:05Z INFO eBPF resources released successfully...
+Cleaning up project directory and file based variables
+00:00
+Job succeeded
- version: 2.1.0-alpha23
-
- π° Keploy: 2024-06-05T06:32:52Z INFO config file not found; proceeding with flags only
- π° 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
- π° Keploy: 2024-06-05T06:32:52Z INFO Example usage: keploy test -c "/path/to/user/app" --delay 6
- π° Keploy: 2024-06-05T06:32:52Z INFO GitHub Actions workflow file generated successfully {"path": "/githubactions/keploy.yml"}
- π° Keploy: 2024-06-05T06:32:53Z INFO keploy initialized and probes added to the kernel.
- π° 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.
- π° Keploy: 2024-06-05T06:32:54Z INFO starting TCP DNS server at addr :26789
- π° Keploy: 2024-06-05T06:32:54Z INFO Proxy started at port:16789
- π° Keploy: 2024-06-05T06:32:54Z INFO running {"test-set": "test-set-0"}
- π° Keploy: 2024-06-05T06:32:54Z INFO starting UDP DNS server at addr :26789
-
- > NodeMongo@1.0.0 start
- > node src/app.js
-
- Listening on port 8000
- Connected to MongoDB
- π° Keploy: 2024-06-05T06:32:59Z INFO starting test for of {"test case": "test-1", "test set": "test-set-0"}
- Testrun passed for testcase with id: "test-1"
-
- --------------------------------------------------------------------
-
- π° Keploy: 2024-06-05T06:32:54Z INFO result {"testcase id": "test-1", "testset id": "test-set-0", "passed": "true"}
-
- <=========================================>
- TESTRUN SUMMARY. For test-set: "test-set-0"
- Total tests: 1
- Total test passed: 1
- Total test failed: 0
- <=========================================>
- ...
- π° Keploy: 2024-06-05T06:32:54Z INFO test run completed {"passed overall": true}
```
_And... voila! You have successfully integrated keploy in GitLab CI/CD pipeline π_
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.
+### π¦ Need the Full Pipeline?
+
+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! β¨π
+
Hope this helps you out, if you still have any questions, reach out to us .
import GetSupport from '../concepts/support.md'