-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to check for the ponylang/net_ssl 105 regression
- Loading branch information
1 parent
9a4d3c0
commit 3494e13
Showing
2 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use "pony_test" | ||
use "net" | ||
|
||
// Tests to verify that the ponylang/net_ssl #105 regression is fixed. | ||
// https://github.com/ponylang/net_ssl/issues/105 | ||
// The expectation is that this test will pass if everything is good. | ||
// Otherwise, the test will segfault when compiled in debug mode or it will | ||
// hang if compled in release mode. | ||
actor \nodoc\ _NetSSL105RegressionTests is TestList | ||
new make() => | ||
None | ||
|
||
fun tag tests(test: PonyTest) => | ||
test(_NetSSL105RegressionTest) | ||
|
||
class \nodoc\ val _NetSSL105RegressionHandlerFactory is HandlerFactory | ||
let _h: TestHelper | ||
|
||
new create(h: TestHelper) => | ||
_h = h | ||
|
||
fun box apply(session: HTTPSession tag): HTTPHandler ref^ => | ||
_NetSSL105RegressionHandler(_h) | ||
|
||
class \nodoc\ val _NetSSL105RegressionHandler is HTTPHandler | ||
let _h: TestHelper | ||
|
||
new create(h: TestHelper) => | ||
_h = h | ||
|
||
fun ref apply(payload: Payload val): None tag => | ||
_h.complete(true) | ||
|
||
class \nodoc\ iso _NetSSL105RegressionTest is UnitTest | ||
fun name(): String => "regression/net_ssl-105" | ||
|
||
fun apply(h: TestHelper) => | ||
h.long_test(2_000_000_000) | ||
|
||
try | ||
let url = URL.build("https://echo.sacovo.ch")? | ||
let auth = TCPConnectAuth(h.env.root) | ||
let client = HTTPClient(auth) | ||
let payload = Payload.request("GET", url) | ||
client.apply(consume payload, _NetSSL105RegressionHandlerFactory(h))? | ||
else | ||
h.fail("Unable to setup test") | ||
end |