Skip to content

Commit c699b9c

Browse files
committed
fix tests
1 parent 96ff314 commit c699b9c

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

crates/stackable-operator/src/utils/cluster_domain.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,21 @@ mod tests {
213213
}
214214

215215
#[test]
216-
fn use_different_kubernetes_service_dns_domain_value() {
217-
let service_dns_domain = "my-cluster.local".to_string();
216+
fn use_different_kubernetes_cluster_domain_value() {
217+
let cluster_domain = "my-cluster.local".to_string();
218+
219+
// set different domain via env var
218220
unsafe {
219-
env::set_var(KUBERNETES_CLUSTER_DOMAIN_ENV, &service_dns_domain);
221+
env::set_var(KUBERNETES_CLUSTER_DOMAIN_ENV, &cluster_domain);
220222
}
221-
//assert_eq!(KUBERNETES_CLUSTER_DOMAIN.get().expect(""), service_dns_domain.try_into().unwrap());
223+
224+
// initialize the lock
225+
let _ = KUBERNETES_CLUSTER_DOMAIN.set(resolve_kubernetes_cluster_domain().unwrap());
226+
227+
assert_eq!(
228+
cluster_domain,
229+
KUBERNETES_CLUSTER_DOMAIN.get().unwrap().to_string()
230+
);
222231
}
223232

224233
#[test]
@@ -233,8 +242,8 @@ mod tests {
233242
let lines = read_file_from_string(resolv_conf);
234243
let last_search_entry = find_last_search_entry(lines.as_slice()).unwrap();
235244
let search_entry = trim_search_line(&last_search_entry).unwrap();
236-
let service_dns_domain = find_shortest_entry(search_entry).unwrap();
237-
//assert_eq!(service_dns_domain, KUBERNETES_SERVICE_DNS_DOMAIN_DEFAULT);
245+
let cluster_domain = find_shortest_entry(search_entry).unwrap();
246+
assert_eq!(cluster_domain, KUBERNETES_CLUSTER_DOMAIN_DEFAULT);
238247
}
239248
}
240249

0 commit comments

Comments
 (0)