fix: cover Windows path and time limits in full test CI

Signed-off-by: WenyXu <wenymedia@gmail.com>
This commit is contained in:
WenyXu
2026-09-23 03:18:43 +00:00
parent 4cdd6d757f
commit 0b754cbbf3
3 changed files with 30 additions and 20 deletions
+9 -9
View File
@@ -157,9 +157,9 @@ jobs:
env:
RUSTFLAGS: "-D warnings"
test-windows-filesystem:
test-windows:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false) }}
name: Test Windows filesystem
name: Test Windows
runs-on: windows-2022
timeout-minutes: 90
env:
@@ -187,17 +187,17 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "test-windows-filesystem"
shared-key: "test-windows"
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install Cargo Nextest
uses: taiki-e/install-action@nextest
- name: Run filesystem regression tests
# Keep this focused and omit dashboard, which requires WSL on Windows.
run: >-
cargo nextest run --locked --lib
-p object-store -p common-datasource -p cli
-E 'package(=object-store) | package(=common-datasource) | (package(=cli) & test(metadata::snapshot::tests::))'
- name: Install WSL distribution
uses: Vampire/setup-wsl@v2
with:
distribution: Ubuntu-22.04
- name: Run Windows tests
run: cargo nextest run --locked --workspace -F dashboard --no-fail-fast
conflict-check:
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false) }}
+2 -1
View File
@@ -790,7 +790,8 @@ mod tests {
async fn test_read_metadata_from_write_cache() {
common_telemetry::init_default_ut_logging();
let mut env = TestEnv::new().await;
let data_home = env.data_home().display().to_string();
// Object keys are relative to the mock store root, not native paths.
let data_home = "write-cache-test".to_string();
let mock_store = env.init_object_store_manager();
let local_dir = create_temp_dir("");
+19 -10
View File
@@ -37,15 +37,15 @@ fn millis_since_epoch(time: SystemTime) -> Result<Timestamp> {
Ok(duration) => (duration.as_millis(), false),
Err(earlier) => (earlier.duration().as_millis(), true),
};
let millis = i64::try_from(millis)
.ok()
.with_context(|| SystemTimeOutOfRangeSnafu { time })?;
let millis =
signed_millis(millis, before_epoch).with_context(|| SystemTimeOutOfRangeSnafu { time })?;
Ok(Timestamp::new_millisecond(millis))
}
Ok(Timestamp::new_millisecond(if before_epoch {
-millis
} else {
millis
}))
/// Converts a millisecond magnitude and epoch direction without platform time limits.
fn signed_millis(millis: u128, before_epoch: bool) -> Option<i64> {
let millis = i64::try_from(millis).ok()?;
Some(if before_epoch { -millis } else { millis })
}
fn build_time_filter(time_index_expr: Expr, start: Timestamp, end: Timestamp) -> Expr {
@@ -139,7 +139,16 @@ mod tests {
#[test]
fn millis_beyond_i64_are_rejected() {
let time = UNIX_EPOCH + Duration::from_secs(1 << 60);
assert!(millis_since_epoch(time).is_err());
let limit = i64::MAX as u128;
assert_eq!(signed_millis(limit, false), Some(i64::MAX));
assert_eq!(signed_millis(limit, true), Some(-i64::MAX));
assert_eq!(signed_millis(limit + 1, false), None);
assert_eq!(signed_millis(limit + 1, true), None);
// Windows cannot represent this SystemTime. The conversion boundary is
// tested above on every platform; exercise the wrapper where possible.
if let Some(time) = UNIX_EPOCH.checked_add(Duration::from_millis(i64::MAX as u64 + 1)) {
assert!(millis_since_epoch(time).is_err());
}
}
}