File tree 1 file changed +37
-0
lines changed
1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -40,3 +40,40 @@ impl RuntimeConfigManager {
40
40
m. clone ( )
41
41
}
42
42
}
43
+
44
+ #[ cfg( test) ]
45
+ mod tests {
46
+ use super :: RuntimeConfigManager ;
47
+
48
+ #[ tokio:: test]
49
+ async fn test_runtime_config_manager ( ) {
50
+ let test_yaml = r#"
51
+ drop_task_killswitch:
52
+ - test:do_nothing"# ;
53
+
54
+ let test_path = "runtime_test_config.yaml" ;
55
+ std:: fs:: write ( test_path, test_yaml) . unwrap ( ) ;
56
+
57
+ let runtime_config = RuntimeConfigManager :: new ( test_path. to_string ( ) ) ;
58
+ let config = runtime_config. read ( ) . await ;
59
+ assert_eq ! ( config. drop_task_killswitch. len( ) , 1 ) ;
60
+ assert_eq ! ( config. drop_task_killswitch[ 0 ] , "test:do_nothing" ) ;
61
+
62
+ std:: fs:: write (
63
+ test_path,
64
+ r#"
65
+ drop_task_killswitch:
66
+ - test:do_nothing
67
+ - test:also_do_nothing"# ,
68
+ )
69
+ . unwrap ( ) ;
70
+
71
+ runtime_config. reload_config ( ) . await ;
72
+ let config = runtime_config. read ( ) . await ;
73
+ assert_eq ! ( config. drop_task_killswitch. len( ) , 2 ) ;
74
+ assert_eq ! ( config. drop_task_killswitch[ 0 ] , "test:do_nothing" ) ;
75
+ assert_eq ! ( config. drop_task_killswitch[ 1 ] , "test:also_do_nothing" ) ;
76
+
77
+ std:: fs:: remove_file ( test_path) . unwrap ( ) ;
78
+ }
79
+ }
You can’t perform that action at this time.
0 commit comments