You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by gk...@apache.org on 2025/07/14 20:17:10 UTC

(iggy) branch io_uring_tpc updated: feat(io_uring): fix state integration tests (#2012)

This is an automated email from the ASF dual-hosted git repository.

gkoszyk pushed a commit to branch io_uring_tpc
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/io_uring_tpc by this push:
     new 8b2a3346 feat(io_uring): fix state integration tests (#2012)
8b2a3346 is described below

commit 8b2a3346f4802e07decbec486c35c92009c80d70
Author: Grzegorz Koszyk <11...@users.noreply.github.com>
AuthorDate: Mon Jul 14 22:17:06 2025 +0200

    feat(io_uring): fix state integration tests (#2012)
---
 core/integration/tests/state/file.rs   | 8 ++++----
 core/integration/tests/state/mod.rs    | 5 ++++-
 core/integration/tests/state/system.rs | 2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/core/integration/tests/state/file.rs b/core/integration/tests/state/file.rs
index 02c6a38b..476e17f4 100644
--- a/core/integration/tests/state/file.rs
+++ b/core/integration/tests/state/file.rs
@@ -26,7 +26,7 @@ use server::state::command::EntryCommand;
 use server::state::entry::StateEntry;
 use server::state::models::{CreateStreamWithId, CreateUserWithId};
 
-#[tokio::test]
+#[compio::test]
 async fn should_be_empty_given_initialized_state() {
     let setup = StateSetup::init().await;
     let state = setup.state();
@@ -35,7 +35,7 @@ async fn should_be_empty_given_initialized_state() {
     assert!(entries.is_empty());
 }
 
-#[tokio::test]
+#[compio::test]
 async fn should_apply_single_entry() {
     let setup = StateSetup::init().await;
     let state = setup.state();
@@ -61,7 +61,7 @@ async fn should_apply_single_entry() {
     assert_entry(entry, 0, setup.version(), user_id, command_bytes);
 }
 
-#[tokio::test]
+#[compio::test]
 async fn should_apply_encrypted_entry() {
     let setup = StateSetup::init_with_encryptor().await;
     let state = setup.state();
@@ -87,7 +87,7 @@ async fn should_apply_encrypted_entry() {
     assert_entry(entry, 0, setup.version(), user_id, command_bytes);
 }
 
-#[tokio::test]
+#[compio::test]
 async fn should_apply_multiple_entries() {
     let setup = StateSetup::init().await;
     let state = setup.state();
diff --git a/core/integration/tests/state/mod.rs b/core/integration/tests/state/mod.rs
index e125a395..2071587f 100644
--- a/core/integration/tests/state/mod.rs
+++ b/core/integration/tests/state/mod.rs
@@ -17,12 +17,14 @@
  */
 
 use iggy::prelude::{Aes256GcmEncryptor, EncryptorKind};
+use server::bootstrap::create_directories;
 use server::state::file::FileState;
 use server::streaming::persistence::persister::{FileWithSyncPersister, PersisterKind};
+use server::streaming::utils::file::overwrite;
 use server::versioning::SemanticVersion;
 use std::str::FromStr;
 use std::sync::Arc;
-use tokio::fs::create_dir;
+use compio::fs::create_dir;
 use uuid::Uuid;
 
 mod file;
@@ -47,6 +49,7 @@ impl StateSetup {
         let directory_path = format!("state_{}", Uuid::now_v7().to_u128_le());
         let messages_file_path = format!("{directory_path}/log");
         create_dir(&directory_path).await.unwrap();
+        overwrite(&messages_file_path).await.unwrap();
 
         let version = SemanticVersion::from_str("1.2.3").unwrap();
         let persister = PersisterKind::FileWithSync(FileWithSyncPersister {});
diff --git a/core/integration/tests/state/system.rs b/core/integration/tests/state/system.rs
index 6fc47b9d..8913f743 100644
--- a/core/integration/tests/state/system.rs
+++ b/core/integration/tests/state/system.rs
@@ -33,7 +33,7 @@ use server::state::models::{
 };
 use server::state::system::SystemState;
 
-#[tokio::test]
+#[compio::test]
 async fn should_be_initialized_based_on_state_entries() {
     let setup = StateSetup::init().await;
     let state = setup.state();