Repository navigation
docs: fix deviations found while walking through the quickstart guides #981
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
base: main
Are you sure you want to change the base?
Changes from all commits
b364fac
a26a43f
c5817ea
bd573b7
319563b
99f33cd
3b98d3d
7f81f1a
894e046
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,7 +206,7 @@ Server is listening at PORT 3000 | |
| API Docs: http://localhost:3000/api/docs | ||
| ``` | ||
|
|
||
| The above command will start recording the API calls made to the application and will generate a test case in the `testcases/` directory. | ||
| The above command will start recording the API calls made to the application and will generate a test case in the `keploy/` directory. | ||
|
|
||
| > 💡 You can use Postman or any other API testing tool to test the API calls. Additionally, the application will run a swagger UI on `http://localhost:3000/api/docs` to visualize the API calls. | ||
|
|
||
|
|
@@ -253,10 +253,10 @@ npm install | |
| cp .env.example .env | ||
| ``` | ||
|
|
||
| We will be using Docker compose to run the application as well as PostreSql on Docker container. | ||
| We will be using Docker compose to run the application as well as PostgreSQL on Docker container. | ||
|
|
||
| Lights, Camera, Record! 🎥 | ||
| Fire up the application and mongoDB instance with Keploy. Keep an eye on the two key flags: -c: Command to run the app (e.g., docker compose up). | ||
| Fire up the application and PostgreSQL instance with Keploy. Keep an eye on the two key flags: -c: Command to run the app (e.g., docker compose up). | ||
|
|
||
| --container-name: The container name in the docker-compose.yml for traffic interception. | ||
|
|
||
|
|
@@ -378,7 +378,7 @@ Using `curl` | |
|
|
||
| ```bash | ||
| curl -X 'PUT' \ | ||
| 'http://localhost:3000/api/v1/task/update/2' \ | ||
| 'http://localhost:3000/api/v1/task/update/1' \ | ||
| -H 'accept: application/json' \ | ||
| -H 'Content-Type: application/json' \ | ||
| -d '{ | ||
|
|
@@ -424,24 +424,22 @@ Node.js v22.7.0 | |
|
|
||
| <=========================================> | ||
| COMPLETE TESTRUN SUMMARY. | ||
| Total tests: 7 | ||
| Total test passed: 7 | ||
| Total tests: 6 | ||
| Total test passed: 6 | ||
| Total test failed: 0 | ||
| Total time taken: "5.66 s" | ||
|
|
||
| Test Suite Name Total Test Passed Failed Time Taken | ||
|
|
||
| "test-set-0" 7 7 0 "5.66 s" | ||
| "test-set-0" 6 6 0 "5.66 s" | ||
| <=========================================> | ||
|
|
||
| 🐰 Keploy: 2024-08-28T10:14:14+05:30 INFO calculating coverage for the test run and inserting it into the report | ||
| 🐰 Keploy: 2024-08-28T10:14:14+05:30 INFO [Total Coverage Percentage: 86.16%] | ||
| 🐰 Keploy: 2024-08-28T10:14:14+05:30 INFO stopping Keploy {"reason": "replay completed successfully"} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing the coverage lines is right for this run btw, keploy skips coverage by default when the command isn't native (
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, dropped that sentence so it matches the run. |
||
| 🐰 Keploy: 2024-08-28T10:14:14+05:30 INFO proxy stopped... | ||
| 🐰 Keploy: 2024-08-28T10:14:17+05:30 INFO eBPF resources released successfully... | ||
| ``` | ||
|
|
||
| Voila! 🎉 You have successfully tested the application using Keploy. Keploy also generates coverage reports for the test-suites. | ||
| Voila! 🎉 You have successfully tested the application using Keploy. | ||
|
|
||
| ## Related | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -75,14 +75,24 @@ git clone https://github.com/keploy/samples-python.git && cd samples-python/flas | |||||
|
|
||||||
| ## Using Docker Compose 🐳 | ||||||
|
|
||||||
| We will be using Docker compose to run the application as well as Mongo on Docker container. | ||||||
| We will be using Docker compose to run the application as well as Redis on Docker container. | ||||||
|
|
||||||
| ### Lights, Camera, Record! 🎥 | ||||||
|
|
||||||
| :::note macOS | ||||||
| Port `5000` is used by the AirPlay Receiver on macOS, so the app fails to start with `address already in use`. Turn it off under **System Settings → General → AirDrop & Continuity → AirPlay Receiver** before recording. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checked this on macOS 26: the pane really is called AirDrop & Continuity there, so your fix is right. on macOS 13 to 15 it's still AirDrop & Handoff though, and a lot of people are still on those. maybe name both:
Suggested change
|
||||||
| ::: | ||||||
|
|
||||||
| The `docker-compose.yml` attaches the services to an external `keploy-network`, so create it once: | ||||||
|
|
||||||
| ```bash | ||||||
| docker network create keploy-network | ||||||
| ``` | ||||||
|
|
||||||
| Capture the test-cases- | ||||||
|
|
||||||
| ```shell | ||||||
| keploy record -c "docker compose up" --container-name "flask-web" --buildDelay 50 | ||||||
| keploy record -c "docker compose up" --container-name "flask-web" --build-delay 50 | ||||||
| ``` | ||||||
|
|
||||||
| 🔥**Make some API calls**. Postman, Hoppscotch or even curl - take your pick! | ||||||
|
|
@@ -148,7 +158,7 @@ spec: | |||||
| ### **Time to run the testcases** | ||||||
|
|
||||||
| ```bash | ||||||
| keploy test -c 'sudo docker compose up' --containerName "flask-web" --delay 10 | ||||||
| keploy test -c 'docker compose up' --container-name "flask-web" --delay 10 | ||||||
| ``` | ||||||
|
|
||||||
| You can also check the test summary from your cli | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -83,6 +83,8 @@ Start the Redis instance using the `docker-compose` file- | |||||
| docker compose up redis | ||||||
| ``` | ||||||
|
|
||||||
| Since the application runs in a container, `localhost` would point to the container itself. In `helpers/redis/redisConnect.go`, change `Addr: "localhost:6379"` to `Addr: "myredis:6379"`. | ||||||
|
|
||||||
| Now, we will create the docker image of our application:- | ||||||
|
|
||||||
| ```bash | ||||||
|
|
@@ -92,7 +94,7 @@ docker build -t gin-app:1.0 . | |||||
| ### Capture the test-cases- | ||||||
|
|
||||||
| ```shell | ||||||
| keploy record -c "docker run -p 3001:3001 --network <networkName> --name ginRedisApp gin-app:1.0" | ||||||
| keploy record -c "docker run -p 3001:3001 --network gin-redis_default --name ginRedisApp gin-app:1.0" | ||||||
| ``` | ||||||
|
|
||||||
| 🔥**Make some API calls**. Postman, Hoppscotch or even curl - take your pick! | ||||||
|
|
@@ -248,8 +250,12 @@ Want to see if everything works as expected? | |||||
|
|
||||||
| Time to put things to the test 🧪 | ||||||
|
|
||||||
| :::note | ||||||
| The OTP changes on every request, so mark it as noise before replaying. Add `body.otp` under `assertions.noise` in the recorded OTP test (the `GET` test in `keploy/test-set-0/tests/`). | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you actually need this on 3.9.3? asking because of what you found in samples-java. when you stop if the GET test really did fail on
assertions:
noise:
body.otp: []if not, i'd reword it for the case where it's actually needed, which is when someone skips the auto-replay with a second
Suggested change
same note at line 471 in the local section. |
||||||
| ::: | ||||||
|
|
||||||
| ```bash | ||||||
| keploy test -c "docker run -p 3001:3001 --rm --network <networkName> --name ginRedisApp gin-app:1.0" --delay 10 | ||||||
| keploy test -c "docker run -p 3001:3001 --rm --network gin-redis_default --name ginRedisApp gin-app:1.0" --delay 10 | ||||||
| ``` | ||||||
|
|
||||||
| > The `--delay` flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking. | ||||||
|
|
@@ -461,6 +467,10 @@ Want to see if everything works as expected? | |||||
|
|
||||||
| Time to put things to the test 🧪 | ||||||
|
|
||||||
| :::note | ||||||
| The OTP changes on every request, so mark it as noise before replaying. Add `body.otp` under `assertions.noise` in the recorded OTP test (the `GET` test in `keploy/test-set-0/tests/`). | ||||||
| ::: | ||||||
|
|
||||||
| ```shell | ||||||
| sudo -E env PATH="$PATH" keploy test -c "./gin-redis" --delay 10 | ||||||
| ``` | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,8 +72,18 @@ git clone https://github.com/keploy/samples-go.git && cd samples-go/mux-sql | |||||||||
| go mod download | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| #### First things first, update the postgres host in main.go to postgres from localhost. | ||||||||||
|
|
||||||||||
| The application runs in a container, where `localhost` does not reach the Postgres container. In `main.go`, change the host `"localhost"` to `"postgres"`. | ||||||||||
|
|
||||||||||
| ### Lights, Camera, Record! 🎥 | ||||||||||
|
|
||||||||||
| The `docker-compose.yml` attaches both services to an external `keploy-network`, so create it once: | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is right for the docker flow 👍 the local section uses the same compose file though ( also while you're in there, line 276 still says the host is on line 10 of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed both: added the network create to the local section and corrected the line number to 18. |
||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| docker network create keploy-network | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| Fire up the application and Postgres instance with Keploy. Keep an eye on the two key flags: | ||||||||||
| `-c`: Command to run the app (e.g., `docker compose up`). | ||||||||||
|
|
||||||||||
|
|
@@ -263,13 +273,16 @@ go mod download | |||||||||
|
|
||||||||||
| We'll be running our sample application right on Linux, but just to make things a tad more thrilling, we'll have the database (Postgres) chill on Docker. Ready? Let's get the party started!🎉 | ||||||||||
|
|
||||||||||
| First things first, update the postgres host on **line 10** in `main.go` to `localhost`. | ||||||||||
| First things first, update the postgres host on **line 18** in `main.go` to `localhost`. | ||||||||||
|
|
||||||||||
| #### 🍃 Kickstart PostgresDB | ||||||||||
|
|
||||||||||
| Let's breathe life into your Postgres container. A simple spell should do the trick: | ||||||||||
|
|
||||||||||
| The `docker-compose.yml` attaches the services to an external `keploy-network`, so create it once. | ||||||||||
|
Comment on lines
280
to
+282
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this one didn't land: "A simple spell should do the trick:" still ends in a colon and is followed by another sentence instead of the command. merging the two:
Suggested change
|
||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| docker network create keploy-network | ||||||||||
| docker compose up postgres | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch on pinning dotnet-ef to 8, the latest one doesn't run on .NET 8. two things nearby that'll still break this flow though:
cd samples-csharp, but the project and compose file moved tocrud-app/(samples-csharp a192656). from the repo rootdocker-compose upand bothdotnet efcommands fail. should becd samples-csharp/crud-appcrud-app/Migrations/already hasInitialMigrationcommitted, sodotnet ef migrations add InitialMigration(around line 98) errors out with a duplicate name. i think onlydotnet ef database updateis neededoptional: after a global tool install people often need
export PATH="$PATH:$HOME/.dotnet/tools", the sample readme mentions itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed all three:
cd samples-csharp/crud-app, droppedmigrations addsinceInitialMigrationis already committed, and added the PATH export.