Fix up tests

This commit is contained in:
Michael Vines
2018-12-14 15:34:17 -08:00
parent 9ef5e51c0f
commit 8ba1aed5a3
6 changed files with 29 additions and 33 deletions

View File

@ -15,5 +15,8 @@ lazy_static = "1.2.0"
sys-info = "0.5.6"
solana-sdk = { path = "../sdk", version = "0.11.0" }
[dev-dependencies]
rand = "0.6.1"
[lib]
name = "solana_metrics"

View File

@ -267,8 +267,9 @@ pub fn set_panic_hook(program: &'static str) {
#[cfg(test)]
mod test {
extern crate rand;
use super::*;
use rand::random;
use std::sync::atomic::{AtomicUsize, Ordering};
struct MockMetricsWriter {
@ -371,11 +372,11 @@ mod test {
.add_tag("test", influxdb::Value::Boolean(true))
.add_field(
"random_bool",
influxdb::Value::Boolean(random::<u8>() < 128),
influxdb::Value::Boolean(rand::random::<u8>() < 128),
)
.add_field(
"random_int",
influxdb::Value::Integer(random::<u8>() as i64),
influxdb::Value::Integer(rand::random::<u8>() as i64),
)
.to_owned();
agent.submit(point);