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

Revert "Add retries to std::net tests (#7898)" #7908

Merged
merged 1 commit into from
Oct 23, 2024
Merged
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
135 changes: 63 additions & 72 deletions tests/test_http_std_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import typing
import json

from edb import errors
from edb.testbase import http as tb


Expand Down Expand Up @@ -100,34 +99,30 @@ async def test_http_std_net_con_schedule_request_get_01(self):
)
)

async for tr in self.try_until_succeeds(
delay=2, timeout=120, ignore=(errors.TransactionSerializationError,)
):
async with tr:
result = await self.con.query_single(
"""
with
nh as module std::net::http,
net as module std::net,
url := <str>$url,
request := (
insert nh::ScheduledRequest {
created_at := datetime_of_statement(),
updated_at := datetime_of_statement(),
state := std::net::RequestState.Pending,
result = await self.con.query_single(
"""
with
nh as module std::net::http,
net as module std::net,
url := <str>$url,
request := (
insert nh::ScheduledRequest {
created_at := datetime_of_statement(),
updated_at := datetime_of_statement(),
state := std::net::RequestState.Pending,

url := url,
method := nh::Method.`GET`,
headers := [
("Accept", "application/json"),
("x-test-header", "test-value"),
],
}
)
select request {*};
""",
url=url,
url := url,
method := nh::Method.`GET`,
headers := [
("Accept", "application/json"),
("x-test-header", "test-value"),
],
}
)
select request {*};
""",
url=url,
)

requests_for_example = None
async for tr in self.try_until_succeeds(
Expand Down Expand Up @@ -177,32 +172,29 @@ async def test_http_std_net_con_schedule_request_post_01(self):
)
)

async for tr in self.try_until_succeeds(
delay=2, timeout=120, ignore=(errors.TransactionSerializationError,)
):
async with tr:
result = await self.con.query_single(
"""
with
nh as module std::net::http,
url := <str>$url,
body := <bytes>$body,
request := (
nh::schedule_request(
url,
method := nh::Method.POST,
headers := [
("Accept", "application/json"),
("x-test-header", "test-value"),
],
body := body,
)
)
select request {*};
""",
url=url,
body=b"Hello, world!",
result = await self.con.query_single(
"""
with
nh as module std::net::http,
net as module std::net,
url := <str>$url,
body := <bytes>$body,
request := (
nh::schedule_request(
url,
method := nh::Method.POST,
headers := [
("Accept", "application/json"),
("x-test-header", "test-value"),
],
body := body,
)
)
select request {*};
""",
url=url,
body=b"Hello, world!",
)

requests_for_example = None
async for tr in self.try_until_succeeds(
Expand Down Expand Up @@ -236,27 +228,26 @@ async def test_http_std_net_con_schedule_request_bad_address(self):
# Test a request to a known-bad address
bad_url = "http://256.256.256.256"

async for tr in self.try_until_succeeds(
delay=2, timeout=120, ignore=(errors.TransactionSerializationError,)
):
async with tr:
result = await self.con.query_single(
"""
with
nh as module std::net::http,
url := <str>$url,
request := (
nh::schedule_request(url)
)
select request {
id,
state,
failure,
response,
};
""",
url=bad_url,
result = await self.con.query_single(
"""
with
nh as module std::net::http,
url := <str>$url,
request := (
nh::schedule_request(
url,
method := nh::Method.`GET`
)
)
select request {
id,
state,
failure,
response,
};
""",
url=bad_url,
)

table_result = await self._wait_for_request_completion(result.id)
self.assertEqual(str(table_result.state), 'Failed')
Expand Down
Loading