data_test.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. suite: secret data test
  2. templates:
  3. - common.yaml
  4. tests:
  5. - it: should pass with key-value data
  6. set:
  7. secret:
  8. my-secret1:
  9. enabled: true
  10. data:
  11. foo: bar
  12. asserts:
  13. - documentIndex: &secretDoc 0
  14. isKind:
  15. of: Secret
  16. - documentIndex: *secretDoc
  17. equal:
  18. path: stringData
  19. value:
  20. foo: bar
  21. - documentIndex: *secretDoc
  22. equal:
  23. path: type
  24. value: Opaque
  25. - it: should pass with custom secret type
  26. set:
  27. secret:
  28. my-secret1:
  29. enabled: true
  30. type: SomeCustomType
  31. data:
  32. foo: bar
  33. asserts:
  34. - documentIndex: *secretDoc
  35. equal:
  36. path: type
  37. value: SomeCustomType
  38. - it: should pass with key-value data from tpl
  39. set:
  40. data: bar
  41. secret:
  42. my-secret1:
  43. enabled: true
  44. data:
  45. foo: "{{ .Values.data }}"
  46. asserts:
  47. - documentIndex: *secretDoc
  48. equal:
  49. path: stringData
  50. value:
  51. foo: bar
  52. - it: should pass with scalar data
  53. set:
  54. secret:
  55. my-secret1:
  56. enabled: true
  57. data:
  58. foo: |
  59. some multi line
  60. string text
  61. asserts:
  62. - documentIndex: *secretDoc
  63. equal:
  64. path: stringData
  65. value:
  66. foo: |
  67. some multi line
  68. string text
  69. - it: should pass with scalar data with tpl
  70. set:
  71. data: Some other text
  72. secret:
  73. my-secret:
  74. enabled: true
  75. data:
  76. foo: |
  77. file start
  78. {{ .Values.data }}
  79. asserts:
  80. - documentIndex: *secretDoc
  81. equal:
  82. path: stringData
  83. value:
  84. foo: |
  85. file start
  86. Some other text
  87. - it: should pass with scalar data from tpl
  88. set:
  89. data: |
  90. Some other text
  91. some_text
  92. secret:
  93. my-secret:
  94. enabled: true
  95. data:
  96. foo: |
  97. {{- .Values.data | nindent 2 }}
  98. asserts:
  99. - documentIndex: *secretDoc
  100. equal:
  101. path: stringData
  102. value:
  103. foo: |
  104. Some other text
  105. some_text