Added missing index check.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
parent
14020cd25f
commit
8efa797494
@ -2238,6 +2238,7 @@ impl DocumentFile {
|
|||||||
reply.add(docs[1].clone());
|
reply.add(docs[1].clone());
|
||||||
for (key, value) in docs[0].iter() {
|
for (key, value) in docs[0].iter() {
|
||||||
self.remove_from_index(key, value, oid);
|
self.remove_from_index(key, value, oid);
|
||||||
|
self.add_to_index(key, docs[1].get_field(key).unwrap().clone(), oid.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reply.into()
|
reply.into()
|
||||||
@ -3036,7 +3037,7 @@ mod document_files {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_field_be_marked_unique() {
|
fn does_update_maintain_unique_fields() {
|
||||||
let (mut docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec());
|
let (mut docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec());
|
||||||
docdef.add_index("field0".to_string(), IndexType::Unique);
|
docdef.add_index("field0".to_string(), IndexType::Unique);
|
||||||
let (queue, rx) = test_doc(doc_name.as_str(), docdef, standard_routes());
|
let (queue, rx) = test_doc(doc_name.as_str(), docdef, standard_routes());
|
||||||
@ -3089,7 +3090,7 @@ mod document_files {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn updating_unique_removes_old_entry() {
|
fn updating_unique_updates_index_entries() {
|
||||||
let (mut docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec());
|
let (mut docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec());
|
||||||
docdef.add_index("field0".to_string(), IndexType::Unique);
|
docdef.add_index("field0".to_string(), IndexType::Unique);
|
||||||
let (queue, rx) = test_doc(doc_name.as_str(), docdef, standard_routes());
|
let (queue, rx) = test_doc(doc_name.as_str(), docdef, standard_routes());
|
||||||
@ -3146,6 +3147,22 @@ mod document_files {
|
|||||||
}
|
}
|
||||||
_ => unreachable!("got {:?}: should have gotten a reply", action),
|
_ => unreachable!("got {:?}: should have gotten a reply", action),
|
||||||
}
|
}
|
||||||
|
addition.add_field("field0".to_string(), new.clone());
|
||||||
|
let msg = Message::new(doc_name.clone(), addition.clone());
|
||||||
|
queue.send(msg).unwrap();
|
||||||
|
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
||||||
|
let action = result.get_action();
|
||||||
|
match action {
|
||||||
|
MsgAction::Error(err) => match err {
|
||||||
|
MTTError::FieldDuplicate(key, field) => {
|
||||||
|
let expected: Field = new.into();
|
||||||
|
assert_eq!(key, "field0");
|
||||||
|
assert_eq!(field, &expected);
|
||||||
|
}
|
||||||
|
_ => unreachable!("got {:?}: should have gotten an missing field", err),
|
||||||
|
},
|
||||||
|
_ => unreachable!("got {:?}: should have gotten an error", action),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user