test_system_clusters.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. import json
  10. from materialize.cloudtest.app.materialize_application import MaterializeApplication
  11. def assert_pod_properties(mz: MaterializeApplication, pod_name: str) -> None:
  12. pod_desc = json.loads(mz.kubectl("get", "-o", "json", "pod", pod_name))
  13. node_selector = pod_desc["spec"]["nodeSelector"]
  14. expected_disk_selection_mode = "true"
  15. assert any(
  16. "disk" in k and v == expected_disk_selection_mode
  17. for k, v in node_selector.items()
  18. ), f"pod {pod_name} does not have the disk={expected_disk_selection_mode} selector"
  19. assert not any(
  20. "availability-zone" in k for k in node_selector.keys()
  21. ), f"pod {pod_name} has a availability-zone selector"
  22. def test_system_clusters(mz: MaterializeApplication) -> None:
  23. """Confirm that the system clusters have the expected labels and selectors"""
  24. mz.wait_replicas()
  25. assert_pod_properties(mz, "cluster-s1-replica-s1-gen-0-0")
  26. assert_pod_properties(mz, "cluster-s2-replica-s2-gen-0-0")