Remove transaction from test search::tests::search for CI
This commit is contained in:
parent
6dd730030d
commit
c3c8f6804b
@ -114,42 +114,35 @@ mod tests {
|
|||||||
let conn = db_pool.clone().get().unwrap();
|
let conn = db_pool.clone().get().unwrap();
|
||||||
|
|
||||||
let title = random_hex()[..8].to_owned();
|
let title = random_hex()[..8].to_owned();
|
||||||
let mut post_id = 0;
|
let (instance, user, blog) = fill_database(&conn);
|
||||||
let (instance, user, blog, post) = &conn
|
let author = &blog.list_authors(&conn).unwrap()[0];
|
||||||
.transaction::<(Instance, User, Blog, Post), diesel::result::Error, _>(|| {
|
|
||||||
let (instance, user, blog) = fill_database(&conn);
|
|
||||||
let author = &blog.list_authors(&conn).unwrap()[0];
|
|
||||||
|
|
||||||
let post = Post::insert(
|
let post = Post::insert(
|
||||||
&conn,
|
&conn,
|
||||||
NewPost {
|
NewPost {
|
||||||
blog_id: blog.id,
|
blog_id: blog.id,
|
||||||
slug: title.clone(),
|
slug: title.clone(),
|
||||||
title: title.clone(),
|
title: title.clone(),
|
||||||
content: SafeString::new(""),
|
content: SafeString::new(""),
|
||||||
published: true,
|
published: true,
|
||||||
license: "CC-BY-SA".to_owned(),
|
license: "CC-BY-SA".to_owned(),
|
||||||
ap_url: "".to_owned(),
|
ap_url: "".to_owned(),
|
||||||
creation_date: None,
|
creation_date: None,
|
||||||
subtitle: "".to_owned(),
|
subtitle: "".to_owned(),
|
||||||
source: "".to_owned(),
|
source: "".to_owned(),
|
||||||
cover_id: None,
|
cover_id: None,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
PostAuthor::insert(
|
PostAuthor::insert(
|
||||||
&conn,
|
&conn,
|
||||||
NewPostAuthor {
|
NewPostAuthor {
|
||||||
post_id: post.id,
|
post_id: post.id,
|
||||||
author_id: author.id,
|
author_id: author.id,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
post_id = post.id;
|
let post_id = post.id;
|
||||||
|
|
||||||
Ok((instance, user, blog, post))
|
|
||||||
})
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Wait for searcher on another thread add document asynchronously
|
// Wait for searcher on another thread add document asynchronously
|
||||||
sleep(Duration::from_millis(700));
|
sleep(Duration::from_millis(700));
|
||||||
@ -162,7 +155,7 @@ mod tests {
|
|||||||
post.delete(&conn).unwrap();
|
post.delete(&conn).unwrap();
|
||||||
blog.delete(&conn).unwrap();
|
blog.delete(&conn).unwrap();
|
||||||
user.delete(&conn).unwrap();
|
user.delete(&conn).unwrap();
|
||||||
diesel::delete(instance).execute(&conn).unwrap();
|
diesel::delete(&instance).execute(&conn).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fill_database(conn: &Conn) -> (Instance, User, Blog) {
|
fn fill_database(conn: &Conn) -> (Instance, User, Blog) {
|
||||||
|
Loading…
Reference in New Issue
Block a user