deployment_test.yaml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. suite: test deployment
  10. templates:
  11. - deployment.yaml
  12. tests:
  13. - it: should create a deployment
  14. asserts:
  15. - isKind:
  16. of: Deployment
  17. - equal:
  18. path: spec.template.spec.containers[0].image
  19. value: materialize/orchestratord:v0.152.0
  20. - equal:
  21. path: spec.template.spec.containers[0].imagePullPolicy
  22. value: IfNotPresent
  23. - equal:
  24. path: spec.template.spec.serviceAccountName
  25. value: orchestratord
  26. - it: should set ephemeral volume class when storage class is configured
  27. set:
  28. storage.storageClass.name: "my-storage-class"
  29. asserts:
  30. - contains:
  31. path: spec.template.spec.containers[0].args
  32. content: "--ephemeral-volume-class=my-storage-class"
  33. - it: should not set ephemeral volume class when storage class is not configured
  34. set:
  35. storage.storageClass.name: ""
  36. asserts:
  37. - notContains:
  38. path: spec.template.spec.containers[0].args
  39. content: "--ephemeral-volume-class"
  40. - it: should set correct base arguments
  41. asserts:
  42. - contains:
  43. path: spec.template.spec.containers[0].args
  44. content: "--startup-log-filter=INFO,mz_orchestratord=TRACE"
  45. - it: should set resources correctly
  46. asserts:
  47. - equal:
  48. path: spec.template.spec.containers[0].resources.requests.cpu
  49. value: 100m
  50. - equal:
  51. path: spec.template.spec.containers[0].resources.requests.memory
  52. value: 512Mi
  53. - equal:
  54. path: spec.template.spec.containers[0].resources.limits.memory
  55. value: 512Mi
  56. - it: should set disk limit to 0 when no storage class is configured
  57. set:
  58. storage.storageClass.name: ""
  59. asserts:
  60. - matchRegex:
  61. path: spec.template.spec.containers[0].args[13] # Index of the environmentd-cluster-replica-sizes argument
  62. pattern: disk_limit":"0"
  63. - matchRegex:
  64. path: spec.template.spec.containers[0].args[13]
  65. pattern: is_cc":true
  66. - it: should have a cluster with disk limit to 1552MiB when storage class is configured
  67. set:
  68. storage.storageClass.name: "my-storage-class"
  69. asserts:
  70. - matchRegex:
  71. path: spec.template.spec.containers[0].args[13]
  72. pattern: disk_limit":"1552MiB"
  73. - matchRegex:
  74. path: spec.template.spec.containers[0].args[13]
  75. pattern: is_cc":true
  76. - it: should configure for AWS provider correctly
  77. set:
  78. operator.cloudProvider.type: "aws"
  79. operator.cloudProvider.region: "us-east-1"
  80. operator.cloudProvider.providers.aws:
  81. enabled: true
  82. accountID: "123456789012"
  83. iam:
  84. roles:
  85. environment: "arn:aws:iam::123456789012:role/env-role"
  86. connection: "arn:aws:iam::123456789012:role/conn-role"
  87. asserts:
  88. - contains:
  89. path: spec.template.spec.containers[0].args
  90. content: "--cloud-provider=aws"
  91. - contains:
  92. path: spec.template.spec.containers[0].args
  93. content: "--region=us-east-1"
  94. - contains:
  95. path: spec.template.spec.containers[0].args
  96. content: "--aws-account-id=123456789012"
  97. - contains:
  98. path: spec.template.spec.containers[0].args
  99. content: "--environmentd-iam-role-arn=arn:aws:iam::123456789012:role/env-role"
  100. - contains:
  101. path: spec.template.spec.containers[0].args
  102. content: "--environmentd-connection-role-arn=arn:aws:iam::123456789012:role/conn-role"
  103. - it: should configure for generic provider correctly
  104. set:
  105. operator.cloudProvider.type: "generic"
  106. operator.cloudProvider.region: "local"
  107. asserts:
  108. - contains:
  109. path: spec.template.spec.containers[0].args
  110. content: "--cloud-provider=generic"
  111. - contains:
  112. path: spec.template.spec.containers[0].args
  113. content: "--region=local"
  114. - notContains:
  115. path: spec.template.spec.containers[0].args
  116. content: "--aws-account-id"
  117. # Feature Flag Tests
  118. - it: should enable balancer creation when configured
  119. set:
  120. balancerd.enabled: true
  121. asserts:
  122. - contains:
  123. path: spec.template.spec.containers[0].args
  124. content: "--create-balancers"
  125. - it: should not enable balancer creation when disabled
  126. set:
  127. balancerd.enabled: false
  128. asserts:
  129. - notContains:
  130. path: spec.template.spec.containers[0].args
  131. content: "--create-balancers"
  132. - it: should enable console creation when configured
  133. set:
  134. console.enabled: true
  135. asserts:
  136. - contains:
  137. path: spec.template.spec.containers[0].args
  138. content: "--create-console"
  139. - it: should configure console image tag map override correctly
  140. set:
  141. console.imageTagMapOverride:
  142. "v0.125.0": "25.1.0"
  143. "v0.126.0": "25.2.0"
  144. asserts:
  145. - contains:
  146. path: spec.template.spec.containers[0].args
  147. content: "--console-image-tag-map=v0.125.0=25.1.0"
  148. - contains:
  149. path: spec.template.spec.containers[0].args
  150. content: "--console-image-tag-map=v0.126.0=25.2.0"
  151. - it: should configure secrets controller kubernetes by default
  152. asserts:
  153. - contains:
  154. path: spec.template.spec.containers[0].args
  155. content: "--secrets-controller=kubernetes"
  156. - it: should configure secrets controller if overridden
  157. set:
  158. operator.secretsController: aws-secrets-manager
  159. asserts:
  160. - notContains:
  161. path: spec.template.spec.containers[0].args
  162. content: "--secrets-controller=kubernetes"
  163. - contains:
  164. path: spec.template.spec.containers[0].args
  165. content: "--secrets-controller=aws-secrets-manager"
  166. - it: should not pass the scheduler when not configured
  167. asserts:
  168. - notContains:
  169. path: spec.template.spec.containers[0].args
  170. content: "--scheduler-name"
  171. - it: should pass the scheduler when configured
  172. set:
  173. schedulerName: my-scheduler
  174. asserts:
  175. - contains:
  176. path: spec.template.spec.containers[0].args
  177. content: "--scheduler-name=my-scheduler"