mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-27 16:48:58 +00:00
test(server): cover default module switch source (#2697)
This commit is contained in:
@@ -258,6 +258,35 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn current_module_switch_snapshot_uses_defaults_when_persisted_file_is_absent() {
|
||||
set_persisted_module_switches(
|
||||
PersistedModuleSwitches {
|
||||
notify_enabled: false,
|
||||
audit_enabled: false,
|
||||
},
|
||||
false,
|
||||
);
|
||||
|
||||
with_vars(
|
||||
[
|
||||
(rustfs_config::ENV_NOTIFY_ENABLE, None::<&str>),
|
||||
(rustfs_config::ENV_AUDIT_ENABLE, None::<&str>),
|
||||
],
|
||||
|| {
|
||||
let snapshot = current_module_switch_snapshot();
|
||||
|
||||
assert_eq!(snapshot.notify_enabled, rustfs_config::DEFAULT_NOTIFY_ENABLE);
|
||||
assert_eq!(snapshot.audit_enabled, rustfs_config::DEFAULT_AUDIT_ENABLE);
|
||||
assert!(!snapshot.persisted_notify_enabled);
|
||||
assert!(!snapshot.persisted_audit_enabled);
|
||||
assert_eq!(snapshot.notify_source, ModuleSwitchSource::Default);
|
||||
assert_eq!(snapshot.audit_source, ModuleSwitchSource::Default);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[serial]
|
||||
fn validate_module_switch_update_rejects_env_conflict() {
|
||||
|
||||
Reference in New Issue
Block a user