diff --git a/.github/workflows/windows-check.yml b/.github/workflows/windows-check.yml new file mode 100644 index 00000000..0c9acd95 --- /dev/null +++ b/.github/workflows/windows-check.yml @@ -0,0 +1,60 @@ +name: Windows tests +on: + pull_request: + types: [opened, reopened, synchronize, labeled] + push: + branches: + - main + +env: + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + CI: 1 + RUST_BACKTRACE: short + RUSTFLAGS: "-D warnings -W unreachable-pub -W bare-trait-objects" + RUSTUP_MAX_RETRIES: 10 + +jobs: + rust: + name: Run rust tests in windows + timeout-minutes: 20 + runs-on: windows-latest + #defaults: + # run: + # working-directory: ./ + #permissions: + #contents: read + #actions: read + #pull-requests: read + env: + #CC: deny_c + RUST_CHANNEL: 'stable' + + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + #- name: Stand up docker services + # uses: hoverkraft-tech/compose-action@v2.2.0 + # with: + # compose-file: compose.yaml + + + - name: Install Rust toolchain + run: | + rustup update --no-self-update ${{ env.RUST_CHANNEL }} + rustup component add --toolchain ${{ env.RUST_CHANNEL }} rustfmt rust-src clippy + rustup default ${{ env.RUST_CHANNEL }} + + - name: Cache Dependencies + uses: Swatinem/rust-cache@v2 + with: + # workspaces: "rust -> target" + key: ${{ env.RUST_CHANNEL }} + + - name: Check + run: | + cargo test --lib diff --git a/icechunk/src/storage/mod.rs b/icechunk/src/storage/mod.rs index eecd8a10..67cbb6e6 100644 --- a/icechunk/src/storage/mod.rs +++ b/icechunk/src/storage/mod.rs @@ -669,10 +669,27 @@ pub fn new_gcs_storage( #[allow(clippy::unwrap_used)] mod tests { - use std::collections::HashSet; + use std::{collections::HashSet, fs::File, io::Write, path::PathBuf}; use super::*; use proptest::prelude::*; + use tempfile::TempDir; + + #[tokio::test] + async fn test_is_clean() { + let repo_dir = TempDir::new().unwrap(); + let s = new_local_filesystem_storage(repo_dir.path()).unwrap(); + assert!(s.root_is_clean().await.unwrap()); + + let mut file = File::create(repo_dir.path().join("foo.txt")).unwrap(); + write!(file, "hello").unwrap(); + assert!(!s.root_is_clean().await.unwrap()); + + let inside_existing = + PathBuf::from_iter([repo_dir.path().as_os_str().to_str().unwrap(), "foo"]); + let s = new_local_filesystem_storage(&inside_existing).unwrap(); + assert!(s.root_is_clean().await.unwrap()); + } proptest! { #![proptest_config(ProptestConfig {