Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 16 additions & 15 deletions cincinnati/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@ authors = ["Alex Crawford <[email protected]>"]
edition = "2018"

[dependencies]
actix-web = "^1.0.2"
commons = { path = "../commons" }
custom_debug_derive = "^0.1.7"
daggy = { version = "^0.6.0", features = [ "serde-1" ] }
env_logger = "^0.6.0"
failure = "^0.1.1"
serde = "1.0.70"
serde_derive = "1.0.70"
commons = { path = "../commons" }
quay = { path = "../quay" }
protobuf = "2.0"
url = "^1.7.2"
log = "^0.4.3"
futures = "0.1"
futures-locks = "0.3.3"
tokio = "0.1"
toml = "^0.4.10"
env_logger = "^0.6.0"
lazy_static = "^1.2.0"
log = "^0.4.3"
prometheus = "^0.7.0"
protobuf = "2.0"
quay = { path = "../quay" }
regex = "^1.1.0"
smart-default = "^0.5.2"
reqwest = "^0.9.19"
actix-web = "^1.0.2"
serde = "1.0.70"
serde_derive = "1.0.70"
serde_json = "^1.0.22"
prometheus = "^0.7.0"
custom_debug_derive = "^0.1.7"
smart-default = "^0.5.2"
tokio = "0.1"
toml = "^0.4.10"
url = "^1.7.2"

[dev-dependencies]
serde_json = "1.0.22"
maplit = "^1.0.2"
mockito = "^0.20.0"
serde_json = "1.0.22"
twoway = "^0.2"

[build-dependencies]
Expand Down
42 changes: 12 additions & 30 deletions cincinnati/src/plugins/internal/node_remove.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//! This plugin removes releases according to its metadata

use prometheus::Registry;
use crate::plugins::{
AsyncIO, BoxedPlugin, InternalIO, InternalPlugin, InternalPluginWrapper, PluginSettings,
};
use failure::Fallible;
use prometheus::Registry;

static DEFAULT_KEY_FILTER: &str = "io.openshift.upgrades.graph";

Expand Down Expand Up @@ -73,8 +73,11 @@ mod tests {
use crate as cincinnati;
use commons::testing::init_runtime;
use failure::ResultExt;
use maplit::hashmap;
use std::collections::HashMap;

type MetadataMap = HashMap<usize, HashMap<String, String>>;

#[test]
fn ensure_release_remove() -> Fallible<()> {
let mut runtime = init_runtime()?;
Expand All @@ -83,39 +86,18 @@ mod tests {
let key_suffix = "release.remove".to_string();

let input_graph: cincinnati::Graph = {
let metadata: HashMap<usize, HashMap<String, String>> = [
(
0,
[(
format!("{}.{}", key_prefix, key_suffix),
String::from("true"),
)]
.iter()
.cloned()
.collect(),
),
(1, HashMap::new()),
(
2,
[(
format!("{}.{}", key_prefix, key_suffix),
String::from("true"),
)]
.iter()
.cloned()
.collect(),
),
]
.iter()
.cloned()
.collect();

let metadata: MetadataMap = hashmap! {
0 => hashmap!{ format!("{}.{}", key_prefix, key_suffix) => String::from("true") },
1 => hashmap!{},
2 => hashmap!{ format!("{}.{}", key_prefix, key_suffix) => String::from("true") },
};
crate::tests::generate_custom_graph(0, metadata.len(), metadata, None)
};

let expected_graph: cincinnati::Graph = {
let metadata: HashMap<usize, HashMap<String, String>> =
[(1, HashMap::new())].iter().cloned().collect();
let metadata: MetadataMap = hashmap! {
1 => hashmap!{},
};

crate::tests::generate_custom_graph(1, metadata.len(), metadata, None)
};
Expand Down