Skip to content

Commit

Permalink
Proper delay control at main test flow
Browse files Browse the repository at this point in the history
Signed-off-by: MOZGIII <mike-n@narod.ru>
  • Loading branch information
MOZGIII committed Jun 10, 2020
1 parent ccf43ae commit 2fe4731
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/kubernetes/reflector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,9 @@ mod tests {
let watcher = InstrumentingWatcher::new(watcher);

// Prepare reflector.
let pause_between_requests = Duration::from_secs(60 * 60); // 1 hour
let mut reflector =
Reflector::new(watcher, state_writer, None, None, Duration::from_secs(1));
Reflector::new(watcher, state_writer, None, None, pause_between_requests);

// Run test logic.
let logic = tokio::spawn(async move {
Expand Down Expand Up @@ -988,6 +989,10 @@ mod tests {
.send(mock_watcher::ScenarioActionStream::Done)
.await
.unwrap();

// Advance the time to scroll pass the delay till next
// invocation.
tokio::time::advance(pause_between_requests * 2).await;
}

// We're done with the test! Shutdown the stream and force an
Expand Down

0 comments on commit 2fe4731

Please sign in to comment.