Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ npm start
4. To reformat:

```sh
npm prettier --write '**/*.{js,md}'
npx prettier --write '**/*.{js,md}'
```

5. Check the build status:
Expand Down
2 changes: 1 addition & 1 deletion src/components/Community.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Community = () => {
Are you curious, 🤔 or do you have questions burning in your mind? 🔥
Look no further! Join our lively Community Forum where you can:
</p>
<ul className="grid gap-6 sm:grid-cols-2 xl:gap-8 list-none">
<ul className="grid list-none gap-6 sm:grid-cols-2 xl:gap-8">
{/*<li>*/}
{/* <a*/}
{/* href="https://community.keploy.io/"*/}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/concepts/reference/glossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function Glossary() {
description="User General Information about Keploy's Documentation"
>
<main className="margin-vert--lg container flex flex-col justify-evenly">
<div className="pb-5 text-center font-bold text-4xl">Glossary</div>
<div className="pb-5 text-center text-4xl font-bold">Glossary</div>
<div className="flex flex-row justify-evenly">
{new Array(26).fill(0).map((x, i) => (
<button
Expand Down
2 changes: 1 addition & 1 deletion src/pages/privacy-policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function PrivacyPolicy() {
description="Privacy Policy information about Keploy."
>
<main className="margin-vert--lg container">
<div className="pb-5 text-center font-bold text-4xl">
<div className="pb-5 text-center text-4xl font-bold">
Keploy Inc. Privacy Policy
</div>
<p className="text-2l md:text-3l mb-2 font-bold tracking-wide">
Expand Down
132 changes: 84 additions & 48 deletions versioned_docs/version-2.0.0/ci-cd/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,60 @@ 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
...
```

> **Note: if you are using `arm_64` as runner use below to download keploy binary**

`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
▓██▓▄
▓▓▓▓██▓█▓▄
████████▓▒
Expand All @@ -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'
Expand Down
Loading