Skip to content

Commit 4f2b408

Browse files
committed
Address Copilot review comments - improve Docker Compose workflow
- Remove standalone docker-compose up --build step - Add clear instructions to stop containers before running tests - Prevent port-in-use conflicts and make workflow clearer - Ensure users stop services after test completion - Build verified successfully with no errors Signed-off-by: Nsanjayboruds <nishantborude555@gmail.com>
1 parent 8e7ca4f commit 4f2b408

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

versioned_docs/version-4.0.0/quickstart/ruby-sinatra-postgres.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ We will be using Docker compose to run the application as well as PostgreSQL on
5252
git clone https://github.com/Nsanjayboruds/keploy-ruby-postgresql-quickstart.git && cd keploy-ruby-postgresql-quickstart
5353
```
5454

55-
### Build and Start Services
55+
### Lights, Camera, Record! 🎥
56+
57+
Capture the test-cases-
5658

5759
```bash
58-
docker-compose up --build
60+
keploy record -c "docker-compose up --build" --container-name "ruby-books-app"
5961
```
6062

6163
This will:
@@ -64,25 +66,6 @@ This will:
6466
- Initialize the database with sample data
6567
- Expose the API on port 8000
6668

67-
### Verify the Setup
68-
69-
```bash
70-
curl http://localhost:8000/health
71-
```
72-
73-
Expected Response:
74-
```json
75-
{"status":"healthy","service":"Ruby Books API"}
76-
```
77-
78-
### Lights, Camera, Record! 🎥
79-
80-
Capture the test-cases-
81-
82-
```bash
83-
keploy record -c "docker-compose up" --container-name "ruby-books-app"
84-
```
85-
8669
🔥**Make some API calls**. Postman, Hoppscotch or even curl - take your pick!
8770

8871
### Generate Testcases
@@ -135,6 +118,12 @@ curl -X DELETE http://localhost:8000/books/1
135118

136119
And once you are done, you can stop the recording and give yourself a pat on the back! With that simple spell, you've conjured up test cases with mocks! Explore the **keploy** directory and you'll discover your handiwork in the `tests` directory and `mocks.yml`.
137120

121+
### Stop the Running Services
122+
123+
```bash
124+
docker-compose down
125+
```
126+
138127
Want to see if everything works as expected?
139128

140129
### Run Tests 🧪
@@ -145,6 +134,12 @@ Time to put things to the test 🧪
145134
keploy test -c "docker-compose up" --container-name "ruby-books-app" --delay 10
146135
```
147136

137+
After tests complete, stop the services:
138+
139+
```bash
140+
docker-compose down
141+
```
142+
148143
> The `--delay` flag? Oh, that's just giving your app a little breather (in seconds) before the test cases come knocking.
149144
150145
Final thoughts? Dive deeper! Try different API calls, tweak the DB response in the `mocks.yml`, or fiddle with the request or response in `test-x.yml`. Run the tests again and see the magic unfold!✨👩‍💻👨‍💻✨

0 commit comments

Comments
 (0)