Add high-level expectations
PiotrSikora opened this issue · comments
Provide high-level expectations, e.g.:
http_headers_test
.http_request(vec![
(":method", "GET"),
(":path", "/hello"),
(":authority", "developer"),
],
None, // request body
None, // request trailers
)
.expect_log(LogLevel::Trace, "#1 -> :method: GET")
.expect_log(LogLevel::Trace, "#1 -> :path: /hello")
.expect_log(LogLevel::Trace, "#1 -> :authority: developer")
.execute_and_expect(ReturnType::Action(Action::Continue))?;
which would be more or less equivalent to this test expressed using currently available low-level expectations:
http_headers_test
.call_start()
.execute_and_expect(ReturnType::None)?;
let root_context = 1;
http_headers_test
.call_proxy_on_context_create(root_context, 0)
.execute_and_expect(ReturnType::None)?;
let http_context = 2;
http_headers_test
.call_proxy_on_context_create(http_context, root_context)
.execute_and_expect(ReturnType::None)?;
http_headers_test
.call_proxy_on_request_headers(http_context, 0)
.expect_get_header_map_pairs(MapType::HttpRequestHeaders)
.returning(vec![
(":method", "GET"),
(":path", "/hello"),
(":authority", "developer"),
])
.expect_log(LogLevel::Trace, "#1 -> :method: GET")
.expect_log(LogLevel::Trace, "#1 -> :path: /hello")
.expect_log(LogLevel::Trace, "#1 -> :authority: developer")
.execute_and_expect(ReturnType::Action(Action::Continue))?;
cc @agiachris
Yes, this is on the TODO for next week.