spec_test.yaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. suite: deployment spec test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should pass with workload enabled
  6. set:
  7. workload:
  8. workload-name:
  9. enabled: true
  10. primary: true
  11. type: Deployment
  12. podSpec: {}
  13. asserts:
  14. - documentIndex: &deploymentDoc 0
  15. isKind:
  16. of: Deployment
  17. - documentIndex: *deploymentDoc
  18. isAPIVersion:
  19. of: apps/v1
  20. - documentIndex: *deploymentDoc
  21. isSubset:
  22. path: spec
  23. content:
  24. replicas: 1
  25. revisionHistoryLimit: 3
  26. strategy:
  27. type: Recreate
  28. - it: should apply spec correctly
  29. set:
  30. workload:
  31. workload-name:
  32. enabled: true
  33. primary: true
  34. type: Deployment
  35. replicas: 2
  36. revisionHistoryLimit: 4
  37. strategy: RollingUpdate
  38. rollingUpdate:
  39. maxSurge: 5
  40. maxUnavailable: 5
  41. podSpec: {}
  42. asserts:
  43. - documentIndex: *deploymentDoc
  44. isSubset:
  45. path: spec
  46. content:
  47. replicas: 2
  48. revisionHistoryLimit: 4
  49. strategy:
  50. type: RollingUpdate
  51. rollingUpdate:
  52. maxSurge: 5
  53. maxUnavailable: 5
  54. - it: should apply maxSurge with 0
  55. set:
  56. workload:
  57. workload-name:
  58. enabled: true
  59. primary: true
  60. type: Deployment
  61. strategy: RollingUpdate
  62. rollingUpdate:
  63. maxSurge: 0
  64. podSpec: {}
  65. asserts:
  66. - documentIndex: *deploymentDoc
  67. isSubset:
  68. path: spec
  69. content:
  70. strategy:
  71. type: RollingUpdate
  72. rollingUpdate:
  73. maxSurge: 0
  74. - it: should apply maxUnavailable with 0
  75. set:
  76. workload:
  77. workload-name:
  78. enabled: true
  79. primary: true
  80. type: Deployment
  81. strategy: RollingUpdate
  82. rollingUpdate:
  83. maxUnavailable: 0
  84. podSpec: {}
  85. asserts:
  86. - documentIndex: *deploymentDoc
  87. isSubset:
  88. path: spec
  89. content:
  90. strategy:
  91. type: RollingUpdate
  92. rollingUpdate:
  93. maxUnavailable: 0
  94. - it: should set replicas to 0 on ixChartContext - isStopped (true)
  95. set:
  96. global:
  97. ixChartContext:
  98. storageClassName: some-storage-class
  99. isStopped: true
  100. workload:
  101. workload-name:
  102. enabled: true
  103. primary: true
  104. type: Deployment
  105. replicas: 2
  106. podSpec: {}
  107. asserts:
  108. - documentIndex: *deploymentDoc
  109. isSubset:
  110. path: spec
  111. content:
  112. replicas: 0
  113. - it: should not set replicas to 0 on ixChartContext - isStopped (false)
  114. set:
  115. global:
  116. ixChartContext:
  117. storageClassName: some-storage-class
  118. isStopped: false
  119. workload:
  120. workload-name:
  121. enabled: true
  122. primary: true
  123. type: Deployment
  124. replicas: 2
  125. podSpec: {}
  126. asserts:
  127. - documentIndex: *deploymentDoc
  128. isSubset:
  129. path: spec
  130. content:
  131. replicas: 2