Skip to content

Commit

Permalink
fix: patches should make tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
emschwartz committed Jul 8, 2024
1 parent 35e9a81 commit e57dbe2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
8 changes: 5 additions & 3 deletions patches/031_rate_limiting.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
diff --git a/exercises/031_rate_limiting.sh b/exercises/031_rate_limiting.sh
index d32f976..9e28a6b 100755
index d32f976..88f5f76 100755
--- a/exercises/031_rate_limiting.sh
+++ b/exercises/031_rate_limiting.sh
@@ -13,7 +13,7 @@ tb "create_transfers id=31000 debit_account_id=3100 credit_account_id=3101 amoun
@@ -13,8 +13,8 @@ tb "create_transfers id=31000 debit_account_id=3100 credit_account_id=3101 amoun

# Now, each time the user makes a request, we'll create a pending transfer with a timeout to temporarily debit the user's account.
# How long should the timeout be? (Hint: the timeout is an interval in seconds.)
-TIMEOUT=???
-for ((i=1; i<=11; i++)); do
+TIMEOUT=60
for ((i=1; i<=11; i++)); do
+for ((i=1; i<=10; i++)); do
id=$((31000 + i))
tb "create_transfers id=${id} debit_account_id=3101 credit_account_id=3100 amount=1 timeout=${TIMEOUT} ledger=310 code=10 flags=pending;"
done
10 changes: 7 additions & 3 deletions patches/032_rate_limiting_bandwidth.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
diff --git a/exercises/032_rate_limiting_bandwidth.sh b/exercises/032_rate_limiting_bandwidth.sh
index dedb290..6d50b1c 100755
index dedb290..14338f7 100755
--- a/exercises/032_rate_limiting_bandwidth.sh
+++ b/exercises/032_rate_limiting_bandwidth.sh
@@ -15,7 +15,7 @@ tb "create_transfers id=32000 debit_account_id=3200 credit_account_id=3201 amoun
for ((i=1; i<=11; i++)); do
@@ -12,10 +12,10 @@ tb "create_accounts id=3200 code=10 ledger=320,
tb "create_transfers id=32000 debit_account_id=3200 credit_account_id=3201 amount=10000000 ledger=320 code=10;"

# Let's say that the user is sending requests that are 1 MB each.
-for ((i=1; i<=11; i++)); do
+for ((i=1; i<=10; i++)); do
id=$((32000 + i))
# What should the amount be?
- amount=???
Expand Down
10 changes: 7 additions & 3 deletions patches/033_rate_limiting_money.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
diff --git a/exercises/033_rate_limiting_money.sh b/exercises/033_rate_limiting_money.sh
index 1b4ff82..457e3dd 100755
index 1b4ff82..d5067ab 100755
--- a/exercises/033_rate_limiting_money.sh
+++ b/exercises/033_rate_limiting_money.sh
@@ -22,8 +22,8 @@ tb "create_transfers id=33000 debit_account_id=3300 credit_account_id=3301 amoun
for ((i=1; i<=11; i++)); do
@@ -19,11 +19,11 @@ tb "create_accounts id=3300 code=10 ledger=$USD_LEDGER,
tb "create_transfers id=33000 debit_account_id=3300 credit_account_id=3301 amount=10000 ledger=$USD_LEDGER code=10,
id=33001 debit_account_id=3302 credit_account_id=3303 amount=100 ledger=$RATE_LIMITING_LEDGER code=10;"

-for ((i=1; i<=11; i++)); do
+for ((i=1; i<=10; i++)); do
id=$((33002 + (i * 2)))
# What flags should these two transfers have? (Hint: they aren't the same.)
- tb "create_transfers id=${id} debit_account_id=3301 credit_account_id=3300 amount=10 ledger=$USD_LEDGER code=10 flags=???,
Expand Down

0 comments on commit e57dbe2

Please sign in to comment.