diff --git a/src/tape/inventory.rs b/src/tape/inventory.rs index a1a667bb..31e3626a 100644 --- a/src/tape/inventory.rs +++ b/src/tape/inventory.rs @@ -513,7 +513,7 @@ impl Inventory { } } MediaSetPolicy::AlwaysCreate => { - set_start_time + 1 + set_start_time } MediaSetPolicy::CreateAt(ref event) => { match compute_next_event(event, set_start_time, false) { diff --git a/src/tape/media_pool.rs b/src/tape/media_pool.rs index a3172f31..93605457 100644 --- a/src/tape/media_pool.rs +++ b/src/tape/media_pool.rs @@ -289,7 +289,7 @@ impl MediaPool { let expire_time = self.inventory.media_expire_time( media.id(), &self.media_set_policy, &self.retention); - current_time > expire_time + current_time >= expire_time } // check if a location is considered on site diff --git a/src/tape/test/alloc_writable_media.rs b/src/tape/test/alloc_writable_media.rs index 4cb48e20..8fc8f532 100644 --- a/src/tape/test/alloc_writable_media.rs +++ b/src/tape/test/alloc_writable_media.rs @@ -58,7 +58,7 @@ fn test_alloc_writable_media_1() -> Result<(), Error> { fn test_alloc_writable_media_2() -> Result<(), Error> { let testdir = create_testdir("test_alloc_writable_media_2")?; - + let mut inventory = Inventory::load(&testdir)?; // tape1: free, assigned to pool @@ -173,16 +173,14 @@ fn test_alloc_writable_media_4() -> Result<(), Error> { // next call fail because there is no free media assert!(pool.alloc_writable_media(start_time + 5).is_err()); - // Create new nedia set, so that revious set can expire + // Create new nedia set, so that previous set can expire pool.start_write_session(start_time + 10)?; assert!(pool.alloc_writable_media(start_time + 10).is_err()); assert!(pool.alloc_writable_media(start_time + 11).is_err()); - assert!(pool.alloc_writable_media(start_time + 12).is_err()); - assert!(pool.alloc_writable_media(start_time + 13).is_err()); // tape1 is now expired - assert_eq!(pool.alloc_writable_media(start_time + 14)?, tape1_uuid); + assert_eq!(pool.alloc_writable_media(start_time + 12)?, tape1_uuid); Ok(()) }