-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt swift-testing for MethodConfig tests (#2055)
Motivation: swift-testing has a number of advantages over XCTest (parameterisation, organisation, failure messages etc.), we should start using it instead of XCTest. Modifications: - Convert the MethodConfig coding tests - Fixed a couple of bugs found by additional testing Results: Fewer bugs, better tests
- Loading branch information
Showing
18 changed files
with
461 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...GRPCCoreTests/Configuration/Inputs/method_config.hedging_policy.invalid.max_attempts.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"maxAttempts": 1, | ||
"hedgingDelay": "1s", | ||
"nonFatalStatusCodes": ["ABORTED"] | ||
} |
5 changes: 5 additions & 0 deletions
5
Tests/GRPCCoreTests/Configuration/Inputs/method_config.hedging_policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"maxAttempts": 3, | ||
"hedgingDelay": "1s", | ||
"nonFatalStatusCodes": ["ABORTED"] | ||
} |
12 changes: 12 additions & 0 deletions
12
Tests/GRPCCoreTests/Configuration/Inputs/method_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": [ | ||
{ | ||
"service": "echo.Echo", | ||
"method": "Get" | ||
} | ||
], | ||
"waitForReady": true, | ||
"timeout": "1s", | ||
"maxRequestMessageBytes": 1024, | ||
"maxResponseMessageBytes": 2048 | ||
} |
1 change: 1 addition & 0 deletions
1
Tests/GRPCCoreTests/Configuration/Inputs/method_config.name.empty.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
4 changes: 4 additions & 0 deletions
4
Tests/GRPCCoreTests/Configuration/Inputs/method_config.name.full.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"service": "foo.bar", | ||
"method": "baz" | ||
} |
3 changes: 3 additions & 0 deletions
3
Tests/GRPCCoreTests/Configuration/Inputs/method_config.name.service_only.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"service": "foo.bar" | ||
} |
7 changes: 7 additions & 0 deletions
7
...CoreTests/Configuration/Inputs/method_config.retry_policy.invalid.backoff_multiplier.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxAttempts": 3, | ||
"initialBackoff": "1s", | ||
"maxBackoff": "3s", | ||
"backoffMultiplier": -1.6, | ||
"retryableStatusCodes": ["ABORTED", "UNAVAILABLE"] | ||
} |
7 changes: 7 additions & 0 deletions
7
...RPCCoreTests/Configuration/Inputs/method_config.retry_policy.invalid.initial_backoff.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxAttempts": 3, | ||
"initialBackoff": "0s", | ||
"maxBackoff": "3s", | ||
"backoffMultiplier": 1.6, | ||
"retryableStatusCodes": ["ABORTED", "UNAVAILABLE"] | ||
} |
7 changes: 7 additions & 0 deletions
7
...s/GRPCCoreTests/Configuration/Inputs/method_config.retry_policy.invalid.max_attempts.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxAttempts": 1, | ||
"initialBackoff": "1s", | ||
"maxBackoff": "3s", | ||
"backoffMultiplier": 1.6, | ||
"retryableStatusCodes": ["ABORTED", "UNAVAILABLE"] | ||
} |
7 changes: 7 additions & 0 deletions
7
Tests/GRPCCoreTests/Configuration/Inputs/method_config.retry_policy.invalid.max_backoff.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxAttempts": 3, | ||
"initialBackoff": "1s", | ||
"maxBackoff": "0s", | ||
"backoffMultiplier": 1.6, | ||
"retryableStatusCodes": ["ABORTED", "UNAVAILABLE"] | ||
} |
7 changes: 7 additions & 0 deletions
7
...Tests/Configuration/Inputs/method_config.retry_policy.invalid.retryable_status_codes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxAttempts": 3, | ||
"initialBackoff": "1s", | ||
"maxBackoff": "3s", | ||
"backoffMultiplier": 1.6, | ||
"retryableStatusCodes": [] | ||
} |
7 changes: 7 additions & 0 deletions
7
Tests/GRPCCoreTests/Configuration/Inputs/method_config.retry_policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"maxAttempts": 3, | ||
"initialBackoff": "1s", | ||
"maxBackoff": "3s", | ||
"backoffMultiplier": 1.6, | ||
"retryableStatusCodes": ["ABORTED", "UNAVAILABLE"] | ||
} |
20 changes: 20 additions & 0 deletions
20
Tests/GRPCCoreTests/Configuration/Inputs/method_config.with_hedging.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": [ | ||
{ | ||
"service": "echo.Echo", | ||
"method": "Get" | ||
} | ||
], | ||
"waitForReady": true, | ||
"timeout": "1s", | ||
"maxRequestMessageBytes": 1024, | ||
"maxResponseMessageBytes": 2048, | ||
"hedgingPolicy": { | ||
"maxAttempts": 3, | ||
"hedgingDelay": "42s", | ||
"nonFatalStatusCodes": [ | ||
"ABORTED", | ||
"UNIMPLEMENTED" | ||
] | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Tests/GRPCCoreTests/Configuration/Inputs/method_config.with_retries.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": [ | ||
{ | ||
"service": "echo.Echo", | ||
"method": "Get" | ||
} | ||
], | ||
"waitForReady": true, | ||
"timeout": "1s", | ||
"maxRequestMessageBytes": 1024, | ||
"maxResponseMessageBytes": 2048, | ||
"retryPolicy": { | ||
"maxAttempts": 3, | ||
"initialBackoff": "1s", | ||
"maxBackoff": "3s", | ||
"backoffMultiplier": 1.6, | ||
"retryableStatusCodes": [ | ||
"ABORTED", | ||
"UNIMPLEMENTED" | ||
] | ||
} | ||
} |
Oops, something went wrong.