Use pretty_assertions in tests (#451)

master
Stanislav Tkach 4 years ago committed by GitHub
parent d0e1ebd801
commit 4a064d0f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Cargo.toml
  2. 2
      tests/test_backup.rs
  3. 26
      tests/test_checkpoint.rs
  4. 2
      tests/test_column_family.rs
  5. 2
      tests/test_compationfilter.rs
  6. 7
      tests/test_db.rs
  7. 2
      tests/test_iterator.rs
  8. 2
      tests/test_merge_operator.rs
  9. 4
      tests/test_multithreaded.rs
  10. 2
      tests/test_pinnable_slice.rs
  11. 2
      tests/test_property.rs
  12. 2
      tests/test_raw_iterator.rs
  13. 3
      tests/test_rocksdb_options.rs
  14. 2
      tests/test_slice_transform.rs
  15. 3
      tests/test_sst_file_writer.rs
  16. 2
      tests/test_write_batch.rs

@ -32,3 +32,4 @@ librocksdb-sys = { path = "librocksdb-sys", version = "6.10.2" }
[dev-dependencies] [dev-dependencies]
trybuild = "1.0.21" trybuild = "1.0.21"
tempfile = "3.1.0" tempfile = "3.1.0"
pretty_assertions = "0.6.1"

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{ use rocksdb::{
backup::{BackupEngine, BackupEngineOptions, RestoreOptions}, backup::{BackupEngine, BackupEngineOptions, RestoreOptions},
DB, DB,

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{checkpoint::Checkpoint, Options, DB}; use rocksdb::{checkpoint::Checkpoint, Options, DB};
use util::DBPath; use util::DBPath;
@ -41,10 +43,10 @@ pub fn test_single_checkpoint() {
// Verify checkpoint // Verify checkpoint
let cp = DB::open_default(&cp1_path).unwrap(); let cp = DB::open_default(&cp1_path).unwrap();
assert_eq!(*cp.get(b"k1").unwrap().unwrap(), *b"v1"); assert_eq!(cp.get(b"k1").unwrap().unwrap(), b"v1");
assert_eq!(*cp.get(b"k2").unwrap().unwrap(), *b"v2"); assert_eq!(cp.get(b"k2").unwrap().unwrap(), b"v2");
assert_eq!(*cp.get(b"k3").unwrap().unwrap(), *b"v3"); assert_eq!(cp.get(b"k3").unwrap().unwrap(), b"v3");
assert_eq!(*cp.get(b"k4").unwrap().unwrap(), *b"v4"); assert_eq!(cp.get(b"k4").unwrap().unwrap(), b"v4");
} }
#[test] #[test]
@ -71,10 +73,10 @@ pub fn test_multi_checkpoints() {
// Verify checkpoint // Verify checkpoint
let cp = DB::open_default(&cp1_path).unwrap(); let cp = DB::open_default(&cp1_path).unwrap();
assert_eq!(*cp.get(b"k1").unwrap().unwrap(), *b"v1"); assert_eq!(cp.get(b"k1").unwrap().unwrap(), b"v1");
assert_eq!(*cp.get(b"k2").unwrap().unwrap(), *b"v2"); assert_eq!(cp.get(b"k2").unwrap().unwrap(), b"v2");
assert_eq!(*cp.get(b"k3").unwrap().unwrap(), *b"v3"); assert_eq!(cp.get(b"k3").unwrap().unwrap(), b"v3");
assert_eq!(*cp.get(b"k4").unwrap().unwrap(), *b"v4"); assert_eq!(cp.get(b"k4").unwrap().unwrap(), b"v4");
// Change some existing keys // Change some existing keys
db.put(b"k1", b"modified").unwrap(); db.put(b"k1", b"modified").unwrap();
@ -92,8 +94,8 @@ pub fn test_multi_checkpoints() {
// Verify second checkpoint // Verify second checkpoint
let cp = DB::open_default(&cp2_path).unwrap(); let cp = DB::open_default(&cp2_path).unwrap();
assert_eq!(*cp.get(b"k1").unwrap().unwrap(), *b"modified"); assert_eq!(cp.get(b"k1").unwrap().unwrap(), b"modified");
assert_eq!(*cp.get(b"k2").unwrap().unwrap(), *b"changed"); assert_eq!(cp.get(b"k2").unwrap().unwrap(), b"changed");
assert_eq!(*cp.get(b"k5").unwrap().unwrap(), *b"v5"); assert_eq!(cp.get(b"k5").unwrap().unwrap(), b"v5");
assert_eq!(*cp.get(b"k6").unwrap().unwrap(), *b"v6"); assert_eq!(cp.get(b"k6").unwrap().unwrap(), b"v6");
} }

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{ColumnFamilyDescriptor, MergeOperands, Options, DB, DEFAULT_COLUMN_FAMILY_NAME}; use rocksdb::{ColumnFamilyDescriptor, MergeOperands, Options, DB, DEFAULT_COLUMN_FAMILY_NAME};
use util::DBPath; use util::DBPath;

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{CompactionDecision, Options, DB}; use rocksdb::{CompactionDecision, Options, DB};
use util::DBPath; use util::DBPath;

@ -14,15 +14,16 @@
mod util; mod util;
use std::{mem, sync::Arc, thread, time::Duration};
use pretty_assertions::assert_eq;
use rocksdb::{ use rocksdb::{
perf::get_memory_usage_stats, BlockBasedOptions, BottommostLevelCompaction, Cache, perf::get_memory_usage_stats, BlockBasedOptions, BottommostLevelCompaction, Cache,
CompactOptions, DBCompactionStyle, Env, Error, FifoCompactOptions, IteratorMode, Options, CompactOptions, DBCompactionStyle, Env, Error, FifoCompactOptions, IteratorMode, Options,
PerfContext, PerfMetric, ReadOptions, SliceTransform, Snapshot, UniversalCompactOptions, PerfContext, PerfMetric, ReadOptions, SliceTransform, Snapshot, UniversalCompactOptions,
UniversalCompactionStopStyle, WriteBatch, DB, UniversalCompactionStopStyle, WriteBatch, DB,
}; };
use std::sync::Arc;
use std::time::Duration;
use std::{mem, thread};
use util::DBPath; use util::DBPath;
#[test] #[test]

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{Direction, IteratorMode, MemtableFactory, Options, DB}; use rocksdb::{Direction, IteratorMode, MemtableFactory, Options, DB};
use util::DBPath; use util::DBPath;

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{DBCompactionStyle, MergeOperands, Options, DB}; use rocksdb::{DBCompactionStyle, MergeOperands, Options, DB};
use util::DBPath; use util::DBPath;

@ -14,9 +14,9 @@
mod util; mod util;
use std::{sync::Arc, thread};
use rocksdb::DB; use rocksdb::DB;
use std::sync::Arc;
use std::thread;
use util::DBPath; use util::DBPath;
const N: usize = 100_000; const N: usize = 100_000;

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{Options, DB}; use rocksdb::{Options, DB};
use util::DBPath; use util::DBPath;

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{Options, DB}; use rocksdb::{Options, DB};
use util::DBPath; use util::DBPath;

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::DB; use rocksdb::DB;
use util::DBPath; use util::DBPath;

@ -14,8 +14,9 @@
mod util; mod util;
use rocksdb::{BlockBasedOptions, DataBlockIndexType, Options, ReadOptions, DB};
use std::{fs, io::Read as _}; use std::{fs, io::Read as _};
use rocksdb::{BlockBasedOptions, DataBlockIndexType, Options, ReadOptions, DB};
use util::DBPath; use util::DBPath;
#[test] #[test]

@ -14,6 +14,8 @@
mod util; mod util;
use pretty_assertions::assert_eq;
use rocksdb::{Options, SliceTransform, DB}; use rocksdb::{Options, SliceTransform, DB};
use util::DBPath; use util::DBPath;

@ -14,8 +14,9 @@
mod util; mod util;
use rocksdb::{Error, Options, SstFileWriter, DB}; use pretty_assertions::assert_eq;
use rocksdb::{Error, Options, SstFileWriter, DB};
use util::DBPath; use util::DBPath;
#[test] #[test]

@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use pretty_assertions::assert_eq;
use rocksdb::WriteBatch; use rocksdb::WriteBatch;
#[test] #[test]

Loading…
Cancel
Save