Skip to content

Commit

Permalink
Add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
ianstanton committed Dec 12, 2023
1 parent 0d19ca7 commit 69cc45b
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tembo-operator/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,33 @@ mod test {
"value": "/certs/tls.crt"
},
],
"storage": {
"volumes": [
{
"name": "ferretdb-data",
"ephemeral": {
"volumeClaimTemplate": {
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "1Gi"
}
}
}
}
}
}
],
"volumeMounts": [
{
"name": "ferretdb-data",
"mountPath": "/state"
}
]
},
}
],
"postgresExporterEnabled": false
Expand Down Expand Up @@ -3047,6 +3074,38 @@ mod test {
assert_eq!(app_1.metadata.name.unwrap(), format!("{cdb_name}-postgrest"));
assert_eq!(app_2.metadata.name.unwrap(), format!("{cdb_name}-test-app-1"));

let selector_map = app_0
.spec
.as_ref()
.and_then(|s| s.selector.match_labels.as_ref())
.expect("Deployment should have a selector");
let selector = selector_map
.iter()
.map(|(k, v)| format!("{}={}", k, v))
.collect::<Vec<_>>()
.join(",");
let lp = ListParams::default().labels(&selector);
let pods: Api<Pod> = Api::namespaced(client.clone(), &namespace);
let pod_list = pods.list(&lp).await.unwrap();
assert_eq!(pod_list.items.len(), 1);
let app_0_pod = pod_list.items[0].clone();
let app_0_container = app_0_pod.spec.unwrap().containers[0].clone();

// Assert app_0 volume mounts include ferretdb-data and tembo-certs
let volume_mounts = app_0_container.volume_mounts.unwrap();
let mut found_ferretdb_data = false;
let mut found_tembo_certs = false;
for mount in volume_mounts {
if mount.mount_path == "/state" {
found_ferretdb_data = true;
}
if mount.mount_path == "/tembo/certs" {
found_tembo_certs = true;
}
}
assert!(found_ferretdb_data);
assert!(found_tembo_certs);

// Assert resources in first appService
// select the pod
let selector_map = app_1
Expand Down

0 comments on commit 69cc45b

Please sign in to comment.