-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathTimeoutTests.cs
More file actions
59 lines (51 loc) · 1.57 KB
/
Copy pathTimeoutTests.cs
File metadata and controls
59 lines (51 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
namespace NpgsqlRestTests;
public static partial class Database
{
public static void TimeoutTests()
{
script.Append(
"""
create function get_command_timeout1()
returns void
language plpgsql
as
$$
begin
perform pg_sleep(2);
end;
$$;
comment on function get_command_timeout1() is 'command_timeout 1sec';
create function get_timeout1()
returns text
language plpgsql
as
$$
begin
perform pg_sleep(2);
return 'this will not be returned';
end;
$$;
comment on function get_timeout1() is 'timeout 1sec';
""");
}
}
[Collection("TestFixture")]
public class TimeoutTests(TestFixture test)
{
[Fact]
public async Task Test_get_command_timeout1()
{
using var response = await test.Client.GetAsync($"/api/get-command-timeout1/");
var content = await response.Content.ReadAsStringAsync();
response.StatusCode.Should().Be(HttpStatusCode.GatewayTimeout);
content.Should().Be("{\"title\":\"Command execution timed out\",\"status\":504}");
}
[Fact]
public async Task Test_get_timeout1()
{
using var response = await test.Client.GetAsync($"/api/get-timeout1/");
var content = await response.Content.ReadAsStringAsync();
response.StatusCode.Should().Be(HttpStatusCode.GatewayTimeout);
content.Should().Be("{\"title\":\"Command execution timed out\",\"status\":504}");
}
}