forked from Proxmox/proxmox
schema: predictable order of errors for tests
Otherwise we'd have to "search" & match the errors... Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
c702638bd8
commit
12da5121ff
@ -1,6 +1,6 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashSet;
|
use std::collections::{BTreeSet, HashSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
@ -229,7 +229,9 @@ impl<'de> de::Visitor<'de> for Visitor {
|
|||||||
_ => return Err(A::Error::invalid_type(Unexpected::Map, &self)),
|
_ => return Err(A::Error::invalid_type(Unexpected::Map, &self)),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut required_keys = HashSet::<&'static str>::new();
|
// The tests need this to be in a predictable order, so HashSet won't work as it uses a
|
||||||
|
// randomized default state.
|
||||||
|
let mut required_keys = BTreeSet::<&'static str>::new();
|
||||||
for (key, optional, _schema) in schema.properties() {
|
for (key, optional, _schema) in schema.properties() {
|
||||||
if !optional {
|
if !optional {
|
||||||
required_keys.insert(key);
|
required_keys.insert(key);
|
||||||
|
Loading…
Reference in New Issue
Block a user