Skip to content
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

feat: refactor concurrent-test directory to script/test #96

Merged
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
14 changes: 8 additions & 6 deletions readme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,12 @@ $ docker-compose.yml up -d
```

#### Bookings Creation
Execute the [create-bookings.sh](../concurrent-test/create-bookings.sh) script to simulate concurrent
booking creation for the same booking dates:

Execute the [concurrent-create-bookings.sh](../script/test/concurrent-create-bookings.sh) script to
simulate concurrent booking creation for the same booking dates:

```bash
$ concurrent-test/create-bookings.sh 2023-10-16 2023-10-17 http:/localhost:80
$ ./script/test/concurrent-create-bookings.sh 2023-10-16 2023-10-17 http:/localhost:80
```
The response should be as follows after formatting, i.e., only one booking was created:
```json
Expand Down Expand Up @@ -195,11 +196,12 @@ The response should be as follows after formatting, i.e., only one booking was c
```

#### Booking Update
Execute the [update-booking.sh](../concurrent-test/update-booking.sh) script to simulate concurrent
updates for the same booking:

Execute the [concurrent-update-booking.sh](../script/test/concurrent-update-booking.sh) script to
simulate concurrent updates for the same booking:

```bash
$ concurrent-test/update-booking.sh 2022-10-25 2022-10-26 http:/localhost:80
$ ./script/test/concurrent-update-booking.sh 2022-10-25 2022-10-26 http:/localhost:80
```
The response should be as follows after formatting, i.e., only one booking was updated:
```json
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ start_date="$1"
end_date="$2"
base_url="$3"

payload1=$(< concurrent-test/booking-payload.json sed -e "s/EMAIL/john.smith.1@email.com/g" \
payload1=$(< script/test/booking-payload.json sed -e "s/EMAIL/john.smith.1@email.com/g" \
| sed -e "s/FULL_NAME/John Smith 1/g" \
| sed -e "s/START_DATE/${start_date}/g" \
| sed -e "s/END_DATE/${end_date}/g")
printf "Create payload 1: %s\n" "$payload1"

payload2=$(< concurrent-test/booking-payload.json sed -e "s/EMAIL/john.smith.2@email.com/g" \
payload2=$(< script/test/booking-payload.json sed -e "s/EMAIL/john.smith.2@email.com/g" \
| sed -e "s/FULL_NAME/John Smith 2/g" \
| sed -e "s/START_DATE/${start_date}/g" \
| sed -e "s/END_DATE/${end_date}/g")
printf "Create payload 2: %s\n" "$payload2"

payload3=$(< concurrent-test/booking-payload.json sed -e "s/EMAIL/john.smith.3@email.com/g" \
payload3=$(< script/test/booking-payload.json sed -e "s/EMAIL/john.smith.3@email.com/g" \
| sed -e "s/FULL_NAME/John Smith 3/g" \
| sed -e "s/START_DATE/${start_date}/g" \
| sed -e "s/END_DATE/${end_date}/g")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ start_date="$1"
end_date="$2"
base_url="$3"

payload=$(< concurrent-test/booking-payload.json sed -e "s/EMAIL/john.smith.1@email.com/g" \
payload=$(< script/test/booking-payload.json sed -e "s/EMAIL/john.smith.1@email.com/g" \
| sed -e "s/FULL_NAME/John Smith 1/g" \
| sed -e "s/START_DATE/$start_date/g" \
| sed -e "s/END_DATE/$end_date/g")
Expand Down
Loading