Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
- name: Run workspace tests
run: cargo test --workspace --all-targets

- name: Core doctests
run: cargo test -p edgezero-core --doc

# The adapter CLI dispatch (build/deploy/stage/healthcheck/rollback) and
# its tests live behind the `cli` feature, which the unfeatured
# `cargo test --workspace` step above does not enable — so none of those
Expand Down
19 changes: 19 additions & 0 deletions crates/edgezero-adapter-cloudflare/tests/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,23 @@ mod tests {
let body = response.text().await.expect("text");
assert_eq!(body, "no");
}

#[wasm_bindgen_test::wasm_bindgen_test]
fn request_timing_clock_handle_and_attachment_work_on_runtime() {
super::request_timing_tests::clock_handle_and_attachment_work_on_runtime();
}

#[wasm_bindgen_test::wasm_bindgen_test]
fn request_timing_clock_advances_in_browser_harness() {
use worker::Date;

let deadline = Date::now().as_millis().saturating_add(2_000_u64);
super::request_timing_tests::clock_advances_on_local_runtime(|| {
Date::now().as_millis() >= deadline
});
}
}

#[cfg(test)]
#[path = "../../edgezero-core/tests/support/request_timing.rs"]
Comment thread
ChristianPavilonis marked this conversation as resolved.
mod request_timing_tests;
19 changes: 19 additions & 0 deletions crates/edgezero-adapter-fastly/tests/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,23 @@ mod tests {
assert_eq!(response.get_status(), FastlyStatus::OK);
assert_eq!(response.take_body_bytes(), b"hello from fastly test");
}

#[test]
fn request_timing_clock_handle_and_attachment_work_on_runtime() {
super::request_timing_tests::clock_handle_and_attachment_work_on_runtime();
}

#[test]
fn request_timing_clock_advances_in_viceroy_harness() {
use std::time::{Duration, SystemTime};

let deadline = SystemTime::now() + Duration::from_secs(2);
super::request_timing_tests::clock_advances_on_local_runtime(|| {
SystemTime::now() >= deadline
});
}
}

#[cfg(test)]
#[path = "../../edgezero-core/tests/support/request_timing.rs"]
mod request_timing_tests;
19 changes: 19 additions & 0 deletions crates/edgezero-adapter-spin/tests/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,4 +536,23 @@ mod tests {
"no secret handle yields the no-handle marker"
);
}

#[test]
fn request_timing_clock_handle_and_attachment_work_on_runtime() {
super::request_timing_tests::clock_handle_and_attachment_work_on_runtime();
}

#[test]
fn request_timing_clock_advances_in_wasmtime_harness() {
use std::time::{Duration, SystemTime};

let deadline = SystemTime::now() + Duration::from_secs(2);
super::request_timing_tests::clock_advances_on_local_runtime(|| {
SystemTime::now() >= deadline
});
}
}

#[cfg(test)]
#[path = "../../edgezero-core/tests/support/request_timing.rs"]
mod request_timing_tests;
1 change: 1 addition & 0 deletions crates/edgezero-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub mod manifest;
pub mod middleware;
pub mod params;
pub mod proxy;
pub mod request_timing;
pub mod responder;
pub mod response;
pub mod router;
Expand Down
Loading
Loading