Skip to content

Commit 520090c

Browse files
committed
Run cargo test as part of the CI
I've added some unit tests recently, but they were not run as part of our GitHub actions. This commit fixes that. Also fix some broken unit tests. The unit tests were correct but sometimes they would race with each other and fail. I added the `serial_test` crate so we can annotate the tests with `#[serial]` to ensure they don't run together (as these tests modify a global variable). Also fixed some unused var warning that seems to have only started showing up in recent versions of rust/clippy.
1 parent bea40c1 commit 520090c

File tree

132 files changed

+19033
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+19033
-1
lines changed

.github/workflows/rust.yml

+2
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ jobs:
2626
run: cargo check
2727
- name: Clippy
2828
run: cargo clippy
29+
- name: Test
30+
run: cargo test

Cargo.lock

+76
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ data-url = "0.3.0"
4747
prost = "0.12.1"
4848
log = "0.4.20"
4949
itertools = "0.12.1"
50+
serial_test = "3.0.0"
5051

5152
[build-dependencies]
5253
prost-build = "0.12.1"

src/config.rs

+5
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,10 @@ pub(crate) fn parse_additional_trust_bundle(value: &str) -> Result<String> {
631631
#[cfg(test)]
632632
mod tests {
633633
use super::*;
634+
use serial_test::serial;
634635

635636
#[test]
637+
#[serial]
636638
fn test_redact_config_file_raw_private_keys() {
637639
let raw_config = r#"
638640
use_key_rules:
@@ -653,6 +655,7 @@ use_key_rules:
653655
}
654656

655657
#[test]
658+
#[serial]
656659
fn test_redact_config_file_raw_pull_secret() {
657660
let raw_config = r#"
658661
pull_secret: |
@@ -670,6 +673,7 @@ pull_secret: |
670673
}
671674

672675
#[test]
676+
#[serial]
673677
fn test_dont_redact_config_file_raw() {
674678
let raw_config = r#"
675679
use_key_rules:
@@ -687,6 +691,7 @@ use_key_rules:
687691
}
688692

689693
#[test]
694+
#[serial]
690695
fn test_pull_secret_not_serialized() {
691696
let mut config = RecertConfig::empty().unwrap();
692697

src/ocp_postprocess/additional_trust_bundle/filesystem_rename.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub(crate) async fn fix_filesystem_ca_trust_anchors(additional_trust_bundle: &st
1111
file_utils::globvec(dir, "**/anchors/openshift-config-user-ca-bundle.crt")?
1212
.into_iter()
1313
.map(|file_path| {
14-
let crt_file_path = file_path.clone();
1514
let additional_trust_bundle = additional_trust_bundle.to_string();
1615
tokio::spawn(async move {
1716
async move {

vendor/dashmap/.cargo-checksum.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"files":{"Cargo.toml":"c758b23fe682b4e447bc5350e1e838577ed6ec4ec8833607ff16f57f1d0495a7","LICENSE":"16692e8cee4aa06e3913787497eba2d47c42002014136f5da67be6ee640e28a3","README.md":"7f7b4edce5b4baabf639df517a66bfa2cd8ff759f09060c17fe6da54531b5819","rust-toolchain.toml":"8e14ad3424881d09f3b219e947b4b95f12726295abde287f91d10af8c5a7dd13","src/arbitrary.rs":"236abf377cbae8393961e0e4327ce2515d5aeeddfb1fabb1f2035c69dfea290c","src/iter.rs":"086a7be951241253b3ea60c64fb324aaa32742038461994e3946bdd8712ce452","src/iter_set.rs":"5327da951dc93d30b293aeb7a805666ee4b8e6364881348ab5d86b23c29a0e13","src/lib.rs":"6ec142f4ad577da1e399738a4bbcdee0baae5290d5b5274e6d295d92bcf113ba","src/lock.rs":"22b1013ee3cbd1598c26403552faf8e5b44fe98a8ff4c8812da15d57bdeee4b3","src/mapref/entry.rs":"c03777d2b863a98fea517ad97037741930c766e7cbd17aea2aab1fbf0e11c719","src/mapref/mod.rs":"15bd45cfc642a9e3e77bbfbf2d9fad9c5fac0ff6904214a3c501e262242ec8b0","src/mapref/multiple.rs":"17a87879229d78f75d71817d100aa0a210d764d6b66e4a05b17a3e092d17e306","src/mapref/one.rs":"0026aff85dd5411b5c181396b8b5b9a9cbc524720a8f409fd4aa62c1b5501146","src/rayon/map.rs":"68d541bb6c9372fe13e44f09d9fcba4f214f52f16649e326486f8976dc03cd99","src/rayon/read_only.rs":"99dc0083f6840f59b2090bc9c5f9767a44088832e63935cb8f6bc7eca8b86102","src/rayon/set.rs":"21fe2ca8c58c8ff1bc753f5e2eb6131afd598211eea375f2ac7190cd0f9abcba","src/read_only.rs":"012a6e44195125eb3c0fd028123b348f5294c7e083bf1c3c0bf8400201c35e27","src/serde.rs":"9854d44b05ebe400ef8ac8ea9c8f140e1c59870d74aaf3ccaf72e82c6dc40905","src/set.rs":"cf75d91db42d18afec314afe9a461cc6e86ddedd11ff9248ed7345780948e5e0","src/setref/mod.rs":"cc39e406a333dc6c04398f4b1336fb400e3a8360c387466d8a91f5d7f4ed40a7","src/setref/multiple.rs":"2270749e83f80dbb4761448f0629ecd02b0b4268f76834236d1167844e6d5e37","src/setref/one.rs":"69738583f2a160f3907e540277ccd88e0036406b3ead66b3d4015ddd938d6937","src/t.rs":"9b40ebfba22369813bf159ed60fa70e742ae72bfaec6aee91a716cba91cb8f0d","src/try_result.rs":"81d1dd396f70b0aa2a6e1969851b706cbfdfb09c802ac9d33dcace882aa28dd1","src/util.rs":"7a8096a713cf04e60d6c9e38cd366314ed74472abab4bb8a3a9ed081a0e0301b"},"package":"978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"}

vendor/dashmap/Cargo.toml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2+
#
3+
# When uploading crates to the registry Cargo will automatically
4+
# "normalize" Cargo.toml files for maximal compatibility
5+
# with all versions of Cargo and also rewrite `path` dependencies
6+
# to registry (e.g., crates.io) dependencies.
7+
#
8+
# If you are reading this file be aware that the original Cargo.toml
9+
# will likely look very different (and much more reasonable).
10+
# See Cargo.toml.orig for the original contents.
11+
12+
[package]
13+
edition = "2018"
14+
rust-version = "1.65"
15+
name = "dashmap"
16+
version = "5.5.3"
17+
authors = ["Acrimon <[email protected]>"]
18+
description = "Blazing fast concurrent HashMap for Rust."
19+
homepage = "https://github.com/xacrimon/dashmap"
20+
documentation = "https://docs.rs/dashmap"
21+
readme = "README.md"
22+
keywords = [
23+
"atomic",
24+
"concurrent",
25+
"hashmap",
26+
]
27+
categories = [
28+
"concurrency",
29+
"algorithms",
30+
"data-structures",
31+
]
32+
license = "MIT"
33+
repository = "https://github.com/xacrimon/dashmap"
34+
35+
[package.metadata.docs.rs]
36+
features = [
37+
"rayon",
38+
"raw-api",
39+
"serde",
40+
]
41+
42+
[dependencies.arbitrary]
43+
version = "1.3.0"
44+
optional = true
45+
46+
[dependencies.cfg-if]
47+
version = "1.0.0"
48+
49+
[dependencies.hashbrown]
50+
version = "0.14.0"
51+
default-features = false
52+
53+
[dependencies.lock_api]
54+
version = "0.4.10"
55+
56+
[dependencies.once_cell]
57+
version = "1.18.0"
58+
59+
[dependencies.parking_lot_core]
60+
version = "0.9.8"
61+
62+
[dependencies.rayon]
63+
version = "1.7.0"
64+
optional = true
65+
66+
[dependencies.serde]
67+
version = "1.0.188"
68+
features = ["derive"]
69+
optional = true
70+
71+
[features]
72+
inline = ["hashbrown/inline-more"]
73+
raw-api = []

vendor/dashmap/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Acrimon
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

vendor/dashmap/README.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# DashMap
2+
3+
Blazingly fast concurrent map in Rust.
4+
5+
DashMap is an implementation of a concurrent associative array/hashmap in Rust.
6+
7+
DashMap tries to implement an easy to use API similar to `std::collections::HashMap`
8+
with some slight changes to handle concurrency.
9+
10+
DashMap tries to be very simple to use and to be a direct replacement for `RwLock<HashMap<K, V>>`.
11+
To accomplish these goals, all methods take `&self` instead of modifying methods taking `&mut self`.
12+
This allows you to put a DashMap in an `Arc<T>` and share it between threads while still being able to modify it.
13+
14+
DashMap puts great effort into performance and aims to be as fast as possible.
15+
If you have any suggestions or tips do not hesitate to open an issue or a PR.
16+
17+
[![version](https://img.shields.io/crates/v/dashmap)](https://crates.io/crates/dashmap)
18+
19+
[![documentation](https://docs.rs/dashmap/badge.svg)](https://docs.rs/dashmap)
20+
21+
[![downloads](https://img.shields.io/crates/d/dashmap)](https://crates.io/crates/dashmap)
22+
23+
[![minimum rustc version](https://img.shields.io/badge/rustc-1.65-orange.svg)](https://crates.io/crates/dashmap)
24+
25+
## Cargo features
26+
27+
- `serde` - Enables serde support.
28+
29+
- `raw-api` - Enables the unstable raw-shard api.
30+
31+
- `rayon` - Enables rayon support.
32+
33+
- `inline` - Enables `inline-more` feature from the `hashbrown` crate. Can lead to better performance, but with the cost of longer compile-time.
34+
35+
- `arbitrary` - Enables support for the `arbitrary` crate.
36+
37+
## Contributing
38+
39+
DashMap gladly accepts contributions!
40+
Do not hesitate to open issues or PR's.
41+
42+
I will take a look as soon as I have time for it.
43+
44+
That said I do not get paid (yet) to work on open-source. This means
45+
that my time is limited and my work here comes after my personal life.
46+
47+
## Performance
48+
49+
A comprehensive benchmark suite including DashMap can be found [here](https://github.com/xacrimon/conc-map-bench).
50+
51+
## Special thanks
52+
53+
- [Jon Gjengset](https://github.com/jonhoo)
54+
55+
- [Yato](https://github.com/RustyYato)
56+
57+
- [Karl Bergström](https://github.com/kabergstrom)
58+
59+
- [Dylan DPC](https://github.com/Dylan-DPC)
60+
61+
- [Lokathor](https://github.com/Lokathor)
62+
63+
- [namibj](https://github.com/namibj)
64+
65+
## License
66+
67+
This project is licensed under MIT.

vendor/dashmap/rust-toolchain.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "1.65"
3+
components = ["rustfmt", "clippy"]
4+
profile = "minimal"

vendor/dashmap/src/arbitrary.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use arbitrary::{Arbitrary, Unstructured};
2+
use core::hash::BuildHasher;
3+
4+
impl<'a, K, V, S> Arbitrary<'a> for crate::DashMap<K, V, S>
5+
where
6+
K: Eq + std::hash::Hash + Arbitrary<'a>,
7+
V: Arbitrary<'a>,
8+
S: Default + BuildHasher + Clone,
9+
{
10+
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
11+
u.arbitrary_iter()?.collect()
12+
}
13+
}

0 commit comments

Comments
 (0)