From d9ef4fed53e8fe4be3fa33bbfc99a165e9029986 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 24 Nov 2017 20:31:10 +0200 Subject: [PATCH] Truncate the temp db before running test_complete_index. Should close #17. --- .gitlab-ci.yml | 4 ++-- hammond-data/src/feed.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8401fd..cd5891d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,8 +43,8 @@ test:stable: image: "rust" script: - rustc --version && cargo --version - - cargo build --all - - cargo test -j 1 --all --verbose + - cargo build + - cargo test -j 1 --verbose test:nightly: # Nightly diff --git a/hammond-data/src/feed.rs b/hammond-data/src/feed.rs index d3432a4..15c0aa6 100644 --- a/hammond-data/src/feed.rs +++ b/hammond-data/src/feed.rs @@ -142,6 +142,7 @@ mod tests { use rss; use models::Source; + use database::connection; use std::fs; use std::io::BufReader; @@ -191,6 +192,16 @@ mod tests { ), ]; + { + // Reset the database into a clean state. + // Test share a Temp file db I think. + let db = connection(); + let con = db.get().unwrap(); + con.execute("DELETE FROM episode").unwrap(); + con.execute("DELETE FROM podcast").unwrap(); + con.execute("DELETE FROM source").unwrap(); + } + let mut feeds: Vec<_> = urls.iter() .map(|&(path, url)| { // Create and insert a Source into db