Enable dev M10 session windows and QUIC route
Foundation / checks (checks) (push) Failing after 56s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (deploy) (push) Canceled after 3m3s
Foundation / checks (client) (push) Canceled after 3m9s
Foundation / checks (network) (push) Canceled after 28s
Foundation / checks (checks) (push) Failing after 56s
Foundation / checks (ecs) (push) Successful in 1m45s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (deploy) (push) Canceled after 3m3s
Foundation / checks (client) (push) Canceled after 3m9s
Foundation / checks (network) (push) Canceled after 28s
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#include "evo/server/session_window.hpp"
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
using evo::server::SessionWindow;
|
||||
|
||||
int main() {
|
||||
constexpr std::uint64_t now = 1'000;
|
||||
|
||||
const auto opened = SessionWindow::open("dev-42:1200", now);
|
||||
assert(opened.has_value());
|
||||
assert(opened->activation_id() == "dev-42");
|
||||
assert(opened->deadline_seconds() == 1200);
|
||||
assert(opened->accepting(1'199));
|
||||
assert(!opened->accepting(1'200));
|
||||
assert(opened->closed());
|
||||
|
||||
// A restart re-reads the same absolute deadline; it does not get a new duration.
|
||||
const auto restarted = SessionWindow::open("dev-42:1200", 1'100);
|
||||
assert(restarted.has_value());
|
||||
assert(restarted->deadline_seconds() == 1200);
|
||||
assert(!SessionWindow::open("dev-42:1200", 1'200).has_value());
|
||||
assert(!SessionWindow::open("dev-42:1200", 1'201).has_value());
|
||||
|
||||
// Delayed application and clock movement cannot extend an expired window.
|
||||
assert(!SessionWindow::open("dev-43:1200", 1'300).has_value());
|
||||
assert(restarted->accepting(1'150));
|
||||
assert(restarted->accepting(1'050));
|
||||
assert(!restarted->accepting(1'200));
|
||||
|
||||
// Invalid activation/deadline forms and excessive windows fail closed.
|
||||
assert(!SessionWindow::open(":1200", now).has_value());
|
||||
assert(!SessionWindow::open("dev space:1200", now).has_value());
|
||||
assert(!SessionWindow::open("dev-44:not-a-number", now).has_value());
|
||||
assert(!SessionWindow::open("dev-45:2001", now).has_value());
|
||||
|
||||
auto close = SessionWindow::open("dev-46:1200", now);
|
||||
assert(close.has_value());
|
||||
close->close();
|
||||
assert(!close->accepting(1'001));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user