validation_test.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. suite: external interface validation test
  2. templates:
  3. - common.yaml
  4. release:
  5. name: release-name
  6. tests:
  7. - it: should fail with targetSelector not a list
  8. set:
  9. scaleExternalInterface:
  10. - targetSelector: "not a list"
  11. asserts:
  12. - failedTemplate:
  13. errorMessage: External Interface - Expected <targetSelector> to be a [list], but got [string]
  14. - it: should fail with empty hostInterface
  15. set:
  16. scaleExternalInterface:
  17. - hostInterface: ""
  18. asserts:
  19. - failedTemplate:
  20. errorMessage: External Interface - Expected non-empty <hostInterface>
  21. - it: should fail with empty ipam
  22. set:
  23. scaleExternalInterface:
  24. - hostInterface: enp0s3
  25. ipam: {}
  26. asserts:
  27. - failedTemplate:
  28. errorMessage: External Interface - Expected non-empty <ipam>
  29. - it: should fail with empty ipam.type
  30. set:
  31. scaleExternalInterface:
  32. - hostInterface: enp0s3
  33. ipam:
  34. type: ""
  35. asserts:
  36. - failedTemplate:
  37. errorMessage: External Interface - Expected non-empty <ipam.type>
  38. - it: should fail with invalid ipam.type
  39. set:
  40. scaleExternalInterface:
  41. - hostInterface: enp0s3
  42. ipam:
  43. type: invalid
  44. asserts:
  45. - failedTemplate:
  46. errorMessage: External Interface - Expected <ipam.type> to be one of [dhcp, static], but got [invalid]
  47. - it: should fail with non-empty staticIPConfigurations on dhcp
  48. set:
  49. scaleExternalInterface:
  50. - hostInterface: enp0s3
  51. ipam:
  52. type: dhcp
  53. staticIPConfigurations:
  54. - ipAddress: 1.2.3.4
  55. asserts:
  56. - failedTemplate:
  57. errorMessage: External Interface - Expected empty <ipam.staticIPConfigurations> and <ipam.staticRoutes> when <ipam.type> is not [static]
  58. - it: should fail with non-empty staticRoutes on dhcp
  59. set:
  60. scaleExternalInterface:
  61. - hostInterface: enp0s3
  62. ipam:
  63. type: dhcp
  64. staticRoutes:
  65. - gateway: 1.2.3.4
  66. destination: 1.2.3.4
  67. asserts:
  68. - failedTemplate:
  69. errorMessage: External Interface - Expected empty <ipam.staticIPConfigurations> and <ipam.staticRoutes> when <ipam.type> is not [static]
  70. - it: should fail with empty staticIPConfigurations on static
  71. set:
  72. scaleExternalInterface:
  73. - hostInterface: enp0s3
  74. ipam:
  75. type: static
  76. staticIPConfigurations: []
  77. asserts:
  78. - failedTemplate:
  79. errorMessage: External Interface - Expected non-empty <ipam.staticIPConfigurations> when <ipam.type> is [static]
  80. - it: should fail with empty gateway on staticRoutes on static
  81. set:
  82. scaleExternalInterface:
  83. - hostInterface: enp0s3
  84. ipam:
  85. type: static
  86. staticIPConfigurations:
  87. - ipAddress: 1.2.3.4
  88. staticRoutes:
  89. - gateway: ""
  90. destination: 1.2.3.4
  91. asserts:
  92. - failedTemplate:
  93. errorMessage: External Interface - Expected non-empty <gateway> in <ipam.staticRoutes>
  94. - it: should fail with empty destination on staticRoutes on static
  95. set:
  96. scaleExternalInterface:
  97. - hostInterface: enp0s3
  98. ipam:
  99. type: static
  100. staticIPConfigurations:
  101. - ipAddress: 1.2.3.4
  102. staticRoutes:
  103. - gateway: 1.2.3.4
  104. destination: ""
  105. asserts:
  106. - failedTemplate:
  107. errorMessage: External Interface - Expected non-empty <destination> in <ipam.staticRoutes>
  108. - it: should fail with empty ixExternalInterfaceConfigurationNames when interface is defined
  109. set:
  110. # Simulate middleware injection
  111. ixExternalInterfacesConfiguration:
  112. - '{"cniVersion": "0.3.1", "name": "ix-release-name-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
  113. ixExternalInterfaceConfigurationNames: []
  114. scaleExternalInterface:
  115. - hostInterface: enp0s3
  116. ipam:
  117. type: dhcp
  118. workload:
  119. workload-name1:
  120. enabled: true
  121. primary: true
  122. type: CronJob
  123. schedule: "*/1 * * * *"
  124. podSpec: {}
  125. asserts:
  126. - failedTemplate:
  127. errorMessage: External Interface - Expected non empty <ixExternalInterfaceConfigurationNames>