• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

getdozer / dozer / 4423198119

pending completion
4423198119

push

github

GitHub
Bump geo from 0.23.1 to 0.24.0 (#1207)

28601 of 39109 relevant lines covered (73.13%)

51246.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/dozer-cache/src/cache/lmdb/tests/read_write.rs
1
use crate::cache::expression::{FilterExpression, Operator, QueryExpression};
2
use crate::cache::lmdb::cache::{CacheOptions, LmdbRoCache, LmdbRwCache};
3
use crate::cache::lmdb::indexing::IndexingThreadPool;
4
use crate::cache::{lmdb::tests::utils as lmdb_utils, test_utils, RoCache, RwCache};
5
use dozer_types::serde_json::Value;
6
use dozer_types::types::Field;
7
use tempdir::TempDir;
×
8
#[test]
1✔
9
fn read_and_write() {
1✔
10
    let path = TempDir::new("dozer").unwrap();
1✔
11
    let path = (path.path().to_path_buf(), "cache".to_string());
1✔
12

1✔
13
    // write and read from cache from two different threads.
1✔
14

1✔
15
    let schema = test_utils::schema_1();
1✔
16
    let mut indexing_thread_pool = IndexingThreadPool::new(1);
1✔
17
    let cache_writer = LmdbRwCache::new(
1✔
18
        Some(&schema),
1✔
19
        &CacheOptions {
1✔
20
            max_readers: 1,
1✔
21
            max_db_size: 100,
1✔
22
            max_size: 1024 * 1024,
1✔
23
            path: Some(path.clone()),
1✔
24
            intersection_chunk_size: 1,
1✔
25
        },
1✔
26
        &mut indexing_thread_pool,
1✔
27
    )
1✔
28
    .unwrap();
1✔
29

1✔
30
    let items = vec![
1✔
31
        (1, Some("a".to_string()), Some(521)),
1✔
32
        (2, Some("a".to_string()), None),
1✔
33
        (3, None, Some(521)),
1✔
34
        (4, None, None),
1✔
35
    ];
1✔
36

×
37
    for val in items.clone() {
4✔
38
        lmdb_utils::insert_rec_1(&cache_writer, &schema.0, val.clone());
4✔
39
    }
4✔
40
    cache_writer.commit().unwrap();
1✔
41

1✔
42
    indexing_thread_pool.wait_until_catchup();
1✔
43

1✔
44
    let read_options = CacheOptions {
1✔
45
        path: Some(path),
1✔
46
        ..Default::default()
1✔
47
    };
1✔
48
    let cache_reader = LmdbRoCache::new(&read_options).unwrap();
1✔
49
    for (a, b, c) in items {
5✔
50
        let rec = cache_reader.get(&Field::Int(a).encode()).unwrap();
4✔
51
        let values = vec![
4✔
52
            Field::Int(a),
4✔
53
            b.map_or(Field::Null, Field::String),
4✔
54
            c.map_or(Field::Null, Field::Int),
4✔
55
        ];
4✔
56
        assert_eq!(rec.record.values, values, "should be equal");
4✔
57
    }
×
58
    let records = cache_reader
1✔
59
        .query(&QueryExpression {
1✔
60
            filter: Some(FilterExpression::Simple(
1✔
61
                "a".to_string(),
1✔
62
                Operator::EQ,
1✔
63
                Value::from(1),
1✔
64
            )),
1✔
65
            ..Default::default()
1✔
66
        })
1✔
67
        .unwrap();
1✔
68
    assert_eq!(records.len(), 1);
1✔
69
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc