testpattern.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. Copyright 2018 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package testpatterns
  14. import (
  15. "k8s.io/api/core/v1"
  16. "k8s.io/kubernetes/test/e2e/framework/volume"
  17. )
  18. const (
  19. // MinFileSize represents minimum file size (1 MiB) for testing
  20. MinFileSize = 1 * volume.MiB
  21. // FileSizeSmall represents small file size (1 MiB) for testing
  22. FileSizeSmall = 1 * volume.MiB
  23. // FileSizeMedium represents medium file size (100 MiB) for testing
  24. FileSizeMedium = 100 * volume.MiB
  25. // FileSizeLarge represents large file size (1 GiB) for testing
  26. FileSizeLarge = 1 * volume.GiB
  27. )
  28. // TestVolType represents a volume type to be tested in a TestSuite
  29. type TestVolType string
  30. var (
  31. // InlineVolume represents a volume type that is used inline in volumeSource
  32. InlineVolume TestVolType = "InlineVolume"
  33. // PreprovisionedPV represents a volume type for pre-provisioned Persistent Volume
  34. PreprovisionedPV TestVolType = "PreprovisionedPV"
  35. // DynamicPV represents a volume type for dynamic provisioned Persistent Volume
  36. DynamicPV TestVolType = "DynamicPV"
  37. )
  38. // TestSnapshotType represents a snapshot type to be tested in a TestSuite
  39. type TestSnapshotType string
  40. var (
  41. // DynamicCreatedSnapshot represents a snapshot type for dynamic created snapshot
  42. DynamicCreatedSnapshot TestSnapshotType = "DynamicSnapshot"
  43. )
  44. // TestPattern represents a combination of parameters to be tested in a TestSuite
  45. type TestPattern struct {
  46. Name string // Name of TestPattern
  47. FeatureTag string // featureTag for the TestSuite
  48. VolType TestVolType // Volume type of the volume
  49. FsType string // Fstype of the volume
  50. VolMode v1.PersistentVolumeMode // PersistentVolumeMode of the volume
  51. SnapshotType TestSnapshotType // Snapshot type of the snapshot
  52. }
  53. var (
  54. // Definitions for default fsType
  55. // DefaultFsInlineVolume is TestPattern for "Inline-volume (default fs)"
  56. DefaultFsInlineVolume = TestPattern{
  57. Name: "Inline-volume (default fs)",
  58. VolType: InlineVolume,
  59. }
  60. // DefaultFsPreprovisionedPV is TestPattern for "Pre-provisioned PV (default fs)"
  61. DefaultFsPreprovisionedPV = TestPattern{
  62. Name: "Pre-provisioned PV (default fs)",
  63. VolType: PreprovisionedPV,
  64. }
  65. // DefaultFsDynamicPV is TestPattern for "Dynamic PV (default fs)"
  66. DefaultFsDynamicPV = TestPattern{
  67. Name: "Dynamic PV (default fs)",
  68. VolType: DynamicPV,
  69. }
  70. // Definitions for ext3
  71. // Ext3InlineVolume is TestPattern for "Inline-volume (ext3)"
  72. Ext3InlineVolume = TestPattern{
  73. Name: "Inline-volume (ext3)",
  74. VolType: InlineVolume,
  75. FsType: "ext3",
  76. }
  77. // Ext3PreprovisionedPV is TestPattern for "Pre-provisioned PV (ext3)"
  78. Ext3PreprovisionedPV = TestPattern{
  79. Name: "Pre-provisioned PV (ext3)",
  80. VolType: PreprovisionedPV,
  81. FsType: "ext3",
  82. }
  83. // Ext3DynamicPV is TestPattern for "Dynamic PV (ext3)"
  84. Ext3DynamicPV = TestPattern{
  85. Name: "Dynamic PV (ext3)",
  86. VolType: DynamicPV,
  87. FsType: "ext3",
  88. }
  89. // Definitions for ext4
  90. // Ext4InlineVolume is TestPattern for "Inline-volume (ext4)"
  91. Ext4InlineVolume = TestPattern{
  92. Name: "Inline-volume (ext4)",
  93. VolType: InlineVolume,
  94. FsType: "ext4",
  95. }
  96. // Ext4PreprovisionedPV is TestPattern for "Pre-provisioned PV (ext4)"
  97. Ext4PreprovisionedPV = TestPattern{
  98. Name: "Pre-provisioned PV (ext4)",
  99. VolType: PreprovisionedPV,
  100. FsType: "ext4",
  101. }
  102. // Ext4DynamicPV is TestPattern for "Dynamic PV (ext4)"
  103. Ext4DynamicPV = TestPattern{
  104. Name: "Dynamic PV (ext4)",
  105. VolType: DynamicPV,
  106. FsType: "ext4",
  107. }
  108. // Definitions for xfs
  109. // XfsInlineVolume is TestPattern for "Inline-volume (xfs)"
  110. XfsInlineVolume = TestPattern{
  111. Name: "Inline-volume (xfs)",
  112. VolType: InlineVolume,
  113. FsType: "xfs",
  114. }
  115. // XfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (xfs)"
  116. XfsPreprovisionedPV = TestPattern{
  117. Name: "Pre-provisioned PV (xfs)",
  118. VolType: PreprovisionedPV,
  119. FsType: "xfs",
  120. }
  121. // XfsDynamicPV is TestPattern for "Dynamic PV (xfs)"
  122. XfsDynamicPV = TestPattern{
  123. Name: "Dynamic PV (xfs)",
  124. VolType: DynamicPV,
  125. FsType: "xfs",
  126. }
  127. // Definitions for ntfs
  128. // NtfsInlineVolume is TestPattern for "Inline-volume (ntfs)"
  129. NtfsInlineVolume = TestPattern{
  130. Name: "Inline-volume (ntfs)",
  131. VolType: InlineVolume,
  132. FsType: "ntfs",
  133. FeatureTag: "[sig-windows]",
  134. }
  135. // NtfsPreprovisionedPV is TestPattern for "Pre-provisioned PV (ntfs)"
  136. NtfsPreprovisionedPV = TestPattern{
  137. Name: "Pre-provisioned PV (ntfs)",
  138. VolType: PreprovisionedPV,
  139. FsType: "ntfs",
  140. FeatureTag: "[sig-windows]",
  141. }
  142. // NtfsDynamicPV is TestPattern for "Dynamic PV (xfs)"
  143. NtfsDynamicPV = TestPattern{
  144. Name: "Dynamic PV (ntfs)",
  145. VolType: DynamicPV,
  146. FsType: "ntfs",
  147. FeatureTag: "[sig-windows]",
  148. }
  149. // Definitions for Filesystem volume mode
  150. // FsVolModePreprovisionedPV is TestPattern for "Pre-provisioned PV (filesystem)"
  151. FsVolModePreprovisionedPV = TestPattern{
  152. Name: "Pre-provisioned PV (filesystem volmode)",
  153. VolType: PreprovisionedPV,
  154. VolMode: v1.PersistentVolumeFilesystem,
  155. }
  156. // FsVolModeDynamicPV is TestPattern for "Dynamic PV (filesystem)"
  157. FsVolModeDynamicPV = TestPattern{
  158. Name: "Dynamic PV (filesystem volmode)",
  159. VolType: DynamicPV,
  160. VolMode: v1.PersistentVolumeFilesystem,
  161. }
  162. // Definitions for block volume mode
  163. // BlockVolModePreprovisionedPV is TestPattern for "Pre-provisioned PV (block)"
  164. BlockVolModePreprovisionedPV = TestPattern{
  165. Name: "Pre-provisioned PV (block volmode)",
  166. VolType: PreprovisionedPV,
  167. VolMode: v1.PersistentVolumeBlock,
  168. }
  169. // BlockVolModeDynamicPV is TestPattern for "Dynamic PV (block)(immediate bind)"
  170. BlockVolModeDynamicPV = TestPattern{
  171. Name: "Dynamic PV (block volmode)",
  172. VolType: DynamicPV,
  173. VolMode: v1.PersistentVolumeBlock,
  174. }
  175. // Definitions for snapshot case
  176. // DynamicSnapshot is TestPattern for "Dynamic snapshot"
  177. DynamicSnapshot = TestPattern{
  178. Name: "Dynamic Snapshot",
  179. SnapshotType: DynamicCreatedSnapshot,
  180. }
  181. )