service_monitor_test.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. suite: test service monitor
  2. templates:
  3. - servicemonitor.yaml
  4. tests:
  5. - it: should render service monitor when APIVersions is present and serviceMonitor is enabled
  6. set:
  7. serviceMonitor.enabled: true
  8. capabilities:
  9. apiVersions:
  10. - "monitoring.coreos.com/v1/ServiceMonitor"
  11. asserts:
  12. - hasDocuments:
  13. count: 3
  14. - it: should render service monitor when APIVersions is not present, serviceMonitor is enabled, and shouldRenderServiceMonitor is alwaysRender
  15. set:
  16. serviceMonitor.enabled: true
  17. serviceMonitor.renderMode: alwaysRender
  18. asserts:
  19. - hasDocuments:
  20. count: 3
  21. - it: should fail if APIVersions is missing, serviceMonitor is enabled, and serviceMonitor.renderMode is failIfMissing
  22. set:
  23. serviceMonitor.enabled: true
  24. serviceMonitor.renderMode: failIfMissing
  25. asserts:
  26. - failedTemplate: {}
  27. - it: should not render service monitor when APIVersions is not present, serviceMonitor is enabled, and serviceMonitor.renderMode is skipIfMissing
  28. set:
  29. serviceMonitor.enabled: true
  30. serviceMonitor.renderMode: skipIfMissing
  31. asserts:
  32. - hasDocuments:
  33. count: 0
  34. - it: should not render service monitor when APIVersions is not present but serviceMonitor is enabled
  35. set:
  36. serviceMonitor.enabled: true
  37. asserts:
  38. - hasDocuments:
  39. count: 0
  40. - it: should not render service monitor when APIVersions is present and serviceMonitor is disabled
  41. set:
  42. serviceMonitor.enabled: false
  43. capabilities:
  44. apiVersions:
  45. - "monitoring.coreos.com/v1/ServiceMonitor"
  46. asserts:
  47. - hasDocuments:
  48. count: 0
  49. - it: should not render service monitor when APIVersions is not present and serviceMonitor is disabled
  50. set:
  51. serviceMonitor.enabled: false
  52. asserts:
  53. - hasDocuments:
  54. count: 0