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

getdozer / dozer / 5939715234

22 Aug 2023 01:47PM UTC coverage: 74.755% (-1.3%) from 76.052%
5939715234

push

github

web-flow
chore: Run e2e tests nightly (#1886)

* chore: Run e2e tests nightly

* chore: Run Dozer CI on default runners

46459 of 62148 relevant lines covered (74.76%)

40132.91 hits per line

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

94.9
/dozer-cli/src/utils.rs
1
use dozer_cache::cache::CacheManagerOptions;
2
use dozer_core::{checkpoint::CheckpointFactoryOptions, executor::ExecutorOptions};
3
use dozer_types::models::{
4
    api_config::{
5
        default_api_grpc, default_api_rest, default_app_grpc, AppGrpcOptions, GrpcApiOptions,
6
        RestApiOptions,
7
    },
8
    api_security::ApiSecurity,
9
    app_config::{
10
        default_app_buffer_size, default_commit_size, default_commit_timeout,
11
        default_error_threshold, default_persist_queue_capacity, DataStorage,
12
    },
13
    config::{default_cache_max_map_size, Config},
14
};
15
use std::time::Duration;
16

17
fn get_cache_max_map_size(config: &Config) -> u64 {
6✔
18
    config
6✔
19
        .cache_max_map_size
6✔
20
        .unwrap_or_else(default_cache_max_map_size)
6✔
21
}
6✔
22

23
fn get_commit_time_threshold(config: &Config) -> Duration {
6✔
24
    Duration::from_millis(
6✔
25
        config
6✔
26
            .app
6✔
27
            .as_ref()
6✔
28
            .and_then(|app| app.commit_timeout)
6✔
29
            .unwrap_or_else(default_commit_timeout),
6✔
30
    )
6✔
31
}
6✔
32

33
fn get_buffer_size(config: &Config) -> u32 {
6✔
34
    config
6✔
35
        .app
6✔
36
        .as_ref()
6✔
37
        .and_then(|app| app.app_buffer_size)
6✔
38
        .unwrap_or_else(default_app_buffer_size)
6✔
39
}
6✔
40

41
fn get_commit_size(config: &Config) -> u32 {
6✔
42
    config
6✔
43
        .app
6✔
44
        .as_ref()
6✔
45
        .and_then(|app| app.commit_size)
6✔
46
        .unwrap_or_else(default_commit_size)
6✔
47
}
6✔
48

49
fn get_error_threshold(config: &Config) -> u32 {
6✔
50
    config
6✔
51
        .app
6✔
52
        .as_ref()
6✔
53
        .and_then(|app| app.error_threshold)
6✔
54
        .unwrap_or_else(default_error_threshold)
6✔
55
}
6✔
56

57
pub fn get_storage_config(config: &Config) -> DataStorage {
12✔
58
    let app = config.app.as_ref();
12✔
59
    app.and_then(|app| app.data_storage.clone())
12✔
60
        .unwrap_or_default()
12✔
61
}
12✔
62

×
63
pub fn get_grpc_config(config: &Config) -> GrpcApiOptions {
6✔
64
    config
6✔
65
        .api
6✔
66
        .as_ref()
6✔
67
        .and_then(|api| api.grpc.clone())
6✔
68
        .unwrap_or_else(default_api_grpc)
6✔
69
}
6✔
70

×
71
pub fn get_rest_config(config: &Config) -> RestApiOptions {
6✔
72
    config
6✔
73
        .api
6✔
74
        .as_ref()
6✔
75
        .and_then(|api| api.rest.clone())
6✔
76
        .unwrap_or_else(default_api_rest)
6✔
77
}
6✔
78

×
79
pub fn get_app_grpc_config(config: &Config) -> AppGrpcOptions {
12✔
80
    config
12✔
81
        .api
12✔
82
        .as_ref()
12✔
83
        .and_then(|api| api.app_grpc.clone())
12✔
84
        .unwrap_or_else(default_app_grpc)
12✔
85
}
12✔
86

×
87
pub fn get_api_security_config(config: &Config) -> Option<&ApiSecurity> {
12✔
88
    config
12✔
89
        .api
12✔
90
        .as_ref()
12✔
91
        .and_then(|api| api.api_security.as_ref())
12✔
92
}
12✔
93

×
94
pub fn get_checkpoint_factory_options(config: &Config) -> CheckpointFactoryOptions {
6✔
95
    CheckpointFactoryOptions {
6✔
96
        persist_queue_capacity: config
6✔
97
            .app
6✔
98
            .as_ref()
6✔
99
            .and_then(|app| app.persist_queue_capacity)
6✔
100
            .unwrap_or_else(default_persist_queue_capacity)
6✔
101
            as usize,
6✔
102
        storage_config: get_storage_config(config),
6✔
103
    }
6✔
104
}
6✔
105

106
pub fn get_executor_options(config: &Config) -> ExecutorOptions {
6✔
107
    ExecutorOptions {
6✔
108
        commit_sz: get_commit_size(config),
6✔
109
        channel_buffer_sz: get_buffer_size(config) as usize,
6✔
110
        commit_time_threshold: get_commit_time_threshold(config),
6✔
111
        error_threshold: Some(get_error_threshold(config)),
6✔
112
    }
6✔
113
}
6✔
114

115
pub fn get_cache_manager_options(config: &Config) -> CacheManagerOptions {
6✔
116
    CacheManagerOptions {
6✔
117
        path: Some(config.cache_dir.clone().into()),
6✔
118
        max_size: get_cache_max_map_size(config) as usize,
6✔
119
        ..CacheManagerOptions::default()
6✔
120
    }
6✔
121
}
6✔
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