MCPcopy Create free account
hub / github.com/Qovery/engine / test_obfuscate_debug_event

Function test_obfuscate_debug_event

lib-engine/src/events/mod.rs:1094–1132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1092
1093 #[test]
1094 fn test_obfuscate_debug_event() {
1095 // setup:
1096 let txt_with_secret = "a txt with secret";
1097 let safe_message = "a txt with secret";
1098
1099 let event_message = EventMessage::new_with_env_vars(
1100 safe_message.to_string(),
1101 Some(txt_with_secret.to_string()),
1102 Some(vec![("my_secret".to_string(), "my_secret_value".to_string())]),
1103 );
1104
1105 let event_details = EventDetails {
1106 provider_kind: Some(Kind::Aws),
1107 organisation_id: QoveryIdentifier::new(Uuid::new_v4()),
1108 cluster_id: QoveryIdentifier::new(Uuid::new_v4()),
1109 execution_id: "ex".to_string(),
1110 stage: Stage::Environment(EnvironmentStep::Build),
1111 transmitter: Transmitter::Application(Uuid::new_v4(), "transmitter".to_string()),
1112 };
1113
1114 let mut engine_event = EngineEvent::Debug(event_details.clone(), event_message.clone());
1115
1116 // execute:
1117 engine_event.obfuscate(|txt| {
1118 if txt == *txt_with_secret {
1119 "xxx".to_string()
1120 } else {
1121 txt
1122 }
1123 });
1124
1125 // verify:
1126 assert!(matches!(engine_event, EngineEvent::Debug(_, _)));
1127 if let EngineEvent::Debug(details, event) = engine_event {
1128 assert_eq!(details, event_details);
1129 assert_eq!(event.full_details, Some("xxx".to_string()));
1130 assert_eq!(event.safe_message, "xxx");
1131 }
1132 }
1133
1134 #[test]
1135 fn test_obfuscate_info_event() {

Callers

nothing calls this directly

Calls 4

EnvironmentClass · 0.85
ApplicationClass · 0.50
cloneMethod · 0.45
obfuscateMethod · 0.45

Tested by

no test coverage detected