From 85fa52c138b7bb01aa2acf8e434071b3514ea993 Mon Sep 17 00:00:00 2001 From: taspelund <15963272+taspelund@users.noreply.github.com> Date: Sat, 26 Oct 2024 12:09:38 -0600 Subject: [PATCH] Fix BGP route deletion and enable rdb tests in CI (#399) * Fix BGP route deletion The closure in remove_bgp_prefixes() was incorrectly returning false when Path.bgp was None. This caused static route paths to be incorrectly deleted during BGP path deletion. Signed-off-by: Trey Aspelund * Enable rdb tests in CI Signed-off-by: Trey Aspelund * Update test db/log filepath Move db/log out of a subdirectory to align with bgp tests, so buildomat scripts are happy and consistent. Signed-off-by: Trey Aspelund --------- Signed-off-by: Trey Aspelund --- .github/buildomat/jobs/test-rdb.sh | 26 ++++++++++++++++++++++++++ rdb/src/db.rs | 6 +++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 .github/buildomat/jobs/test-rdb.sh diff --git a/.github/buildomat/jobs/test-rdb.sh b/.github/buildomat/jobs/test-rdb.sh new file mode 100755 index 00000000..9d2f0919 --- /dev/null +++ b/.github/buildomat/jobs/test-rdb.sh @@ -0,0 +1,26 @@ +#!/bin/bash +#: +#: name = "test-rdb" +#: variety = "basic" +#: target = "helios-2.0" +#: rust_toolchain = "stable" +#: output_rules = [ +#: "/work/*.log", +#: ] +#: access_repos = [ +#: "oxidecomputer/dendrite", +#: ] +#: + +set -x +set -e + +cargo --version +rustc --version + +cargo install cargo-nextest + +pushd rdb + +cargo nextest run +cp *.log /work/ diff --git a/rdb/src/db.rs b/rdb/src/db.rs index de7f5730..5c0b6274 100644 --- a/rdb/src/db.rs +++ b/rdb/src/db.rs @@ -577,7 +577,7 @@ impl Db { self.remove_prefix_path(prefix, |rib_path: &Path| { match rib_path.bgp { Some(ref bgp) => bgp.id == id, - None => true, + None => false, } }); pcn.changed.insert(prefix); @@ -779,8 +779,8 @@ mod test { let static_path1 = Path::from(static_key1); // setup - let log = init_file_logger("/tmp/rib.log"); - let db_path = "/tmp/rb.db".to_string(); + let log = init_file_logger("rib.log"); + let db_path = "rib.db".to_string(); let _ = std::fs::remove_dir_all(&db_path); let db = Db::new(&db_path, log.clone()).expect("create db");