Skip to content

Commit 1c8c850

Browse files
committed
Skip expensive integration tests in short run mode
1 parent 205d5c5 commit 1c8c850

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

staging/src/k8s.io/apiextensions-apiserver/test/integration/limit_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
8080

8181
// Create YAML just under 3MB limit, nested
8282
t.Run("create YAML doc under limit, nested", func(t *testing.T) {
83+
if testing.Short() {
84+
t.Skip("skipping expensive test")
85+
}
8386
yamlBody := []byte(fmt.Sprintf(`
8487
apiVersion: %s
8588
kind: %s
@@ -100,6 +103,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
100103

101104
// Create YAML just under 3MB limit, not nested
102105
t.Run("create YAML doc under limit, not nested", func(t *testing.T) {
106+
if testing.Short() {
107+
t.Skip("skipping expensive test")
108+
}
103109
yamlBody := []byte(fmt.Sprintf(`
104110
apiVersion: %s
105111
kind: %s
@@ -141,6 +147,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
141147

142148
// Create JSON just under 3MB limit, nested
143149
t.Run("create JSON doc under limit, nested", func(t *testing.T) {
150+
if testing.Short() {
151+
t.Skip("skipping expensive test")
152+
}
144153
jsonBody := []byte(fmt.Sprintf(`{
145154
"apiVersion": %q,
146155
"kind": %q,
@@ -162,6 +171,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
162171

163172
// Create JSON just under 3MB limit, not nested
164173
t.Run("create JSON doc under limit, not nested", func(t *testing.T) {
174+
if testing.Short() {
175+
t.Skip("skipping expensive test")
176+
}
165177
jsonBody := []byte(fmt.Sprintf(`{
166178
"apiVersion": %q,
167179
"kind": %q,
@@ -191,6 +203,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
191203
}
192204

193205
t.Run("JSONPatchType nested patch under limit", func(t *testing.T) {
206+
if testing.Short() {
207+
t.Skip("skipping expensive test")
208+
}
194209
patchBody := []byte(`[{"op":"add","path":"/foo","value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}]`)
195210
err = rest.Patch(types.JSONPatchType).AbsPath("/apis", noxuDefinition.Spec.Group, noxuDefinition.Spec.Version, noxuDefinition.Spec.Names.Plural, "test").
196211
Body(patchBody).Do(context.TODO()).Error()
@@ -199,6 +214,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
199214
}
200215
})
201216
t.Run("MergePatchType nested patch under limit", func(t *testing.T) {
217+
if testing.Short() {
218+
t.Skip("skipping expensive test")
219+
}
202220
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
203221
err = rest.Patch(types.MergePatchType).AbsPath("/apis", noxuDefinition.Spec.Group, noxuDefinition.Spec.Version, noxuDefinition.Spec.Names.Plural, "test").
204222
Body(patchBody).Do(context.TODO()).Error()
@@ -207,6 +225,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
207225
}
208226
})
209227
t.Run("ApplyPatchType nested patch under limit", func(t *testing.T) {
228+
if testing.Short() {
229+
t.Skip("skipping expensive test")
230+
}
210231
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
211232
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath("/apis", noxuDefinition.Spec.Group, noxuDefinition.Spec.Version, noxuDefinition.Spec.Names.Plural, "test").
212233
Body(patchBody).Do(context.TODO()).Error()

test/integration/apiserver/max_request_body_bytes_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ func TestMaxResourceSize(t *testing.T) {
8585
}
8686
})
8787
t.Run("JSONPatchType should handle a patch just under the max limit", func(t *testing.T) {
88+
if testing.Short() {
89+
t.Skip("skipping expensive test")
90+
}
8891
patchBody := []byte(`[{"op":"add","path":"/foo","value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}]`)
8992
err = rest.Patch(types.JSONPatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
9093
Body(patchBody).Do(context.TODO()).Error()
@@ -93,6 +96,9 @@ func TestMaxResourceSize(t *testing.T) {
9396
}
9497
})
9598
t.Run("JSONPatchType should handle a valid patch just under the max limit", func(t *testing.T) {
99+
if testing.Short() {
100+
t.Skip("skipping expensive test")
101+
}
96102
patchBody := []byte(`[{"op":"add","path":"/foo","value":0` + strings.Repeat(" ", 3*1024*1024-100) + `}]`)
97103
err = rest.Patch(types.JSONPatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
98104
Body(patchBody).Do(context.TODO()).Error()
@@ -101,6 +107,9 @@ func TestMaxResourceSize(t *testing.T) {
101107
}
102108
})
103109
t.Run("MergePatchType should handle a patch just under the max limit", func(t *testing.T) {
110+
if testing.Short() {
111+
t.Skip("skipping expensive test")
112+
}
104113
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
105114
err = rest.Patch(types.MergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
106115
Body(patchBody).Do(context.TODO()).Error()
@@ -109,6 +118,9 @@ func TestMaxResourceSize(t *testing.T) {
109118
}
110119
})
111120
t.Run("MergePatchType should handle a valid patch just under the max limit", func(t *testing.T) {
121+
if testing.Short() {
122+
t.Skip("skipping expensive test")
123+
}
112124
patchBody := []byte(`{"value":0` + strings.Repeat(" ", 3*1024*1024-100) + `}`)
113125
err = rest.Patch(types.MergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
114126
Body(patchBody).Do(context.TODO()).Error()
@@ -117,6 +129,9 @@ func TestMaxResourceSize(t *testing.T) {
117129
}
118130
})
119131
t.Run("StrategicMergePatchType should handle a patch just under the max limit", func(t *testing.T) {
132+
if testing.Short() {
133+
t.Skip("skipping expensive test")
134+
}
120135
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
121136
err = rest.Patch(types.StrategicMergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
122137
Body(patchBody).Do(context.TODO()).Error()
@@ -125,6 +140,9 @@ func TestMaxResourceSize(t *testing.T) {
125140
}
126141
})
127142
t.Run("StrategicMergePatchType should handle a valid patch just under the max limit", func(t *testing.T) {
143+
if testing.Short() {
144+
t.Skip("skipping expensive test")
145+
}
128146
patchBody := []byte(`{"value":0` + strings.Repeat(" ", 3*1024*1024-100) + `}`)
129147
err = rest.Patch(types.StrategicMergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
130148
Body(patchBody).Do(context.TODO()).Error()
@@ -133,6 +151,9 @@ func TestMaxResourceSize(t *testing.T) {
133151
}
134152
})
135153
t.Run("ApplyPatchType should handle a patch just under the max limit", func(t *testing.T) {
154+
if testing.Short() {
155+
t.Skip("skipping expensive test")
156+
}
136157
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
137158
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath("/api/v1/namespaces/default/secrets/test").
138159
Body(patchBody).Do(context.TODO()).Error()
@@ -141,6 +162,9 @@ func TestMaxResourceSize(t *testing.T) {
141162
}
142163
})
143164
t.Run("ApplyPatchType should handle a valid patch just under the max limit", func(t *testing.T) {
165+
if testing.Short() {
166+
t.Skip("skipping expensive test")
167+
}
144168
patchBody := []byte(`{"apiVersion":"v1","kind":"Secret"` + strings.Repeat(" ", 3*1024*1024-100) + `}`)
145169
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath("/api/v1/namespaces/default/secrets/test").
146170
Body(patchBody).Do(context.TODO()).Error()
@@ -182,6 +206,9 @@ values: ` + strings.Repeat("[", 3*1024*1024))
182206

183207
// Create YAML just under 3MB limit, nested
184208
t.Run("create should handle a yaml document just under the maximum size with correct nesting", func(t *testing.T) {
209+
if testing.Short() {
210+
t.Skip("skipping expensive test")
211+
}
185212
yamlBody := []byte(`
186213
apiVersion: v1
187214
kind: ConfigMap
@@ -202,6 +229,9 @@ values: ` + strings.Repeat("[", 3*1024*1024/2-500) + strings.Repeat("]", 3*1024*
202229

203230
// Create YAML just under 3MB limit, not nested
204231
t.Run("create should handle a yaml document just under the maximum size with unbalanced nesting", func(t *testing.T) {
232+
if testing.Short() {
233+
t.Skip("skipping expensive test")
234+
}
205235
yamlBody := []byte(`
206236
apiVersion: v1
207237
kind: ConfigMap
@@ -243,6 +273,9 @@ values: ` + strings.Repeat("[", 3*1024*1024-1000))
243273

244274
// Create JSON just under 3MB limit, nested
245275
t.Run("create should handle a json document just under the maximum size with correct nesting", func(t *testing.T) {
276+
if testing.Short() {
277+
t.Skip("skipping expensive test")
278+
}
246279
jsonBody := []byte(`{
247280
"apiVersion": "v1",
248281
"kind": "ConfigMap",
@@ -265,6 +298,9 @@ values: ` + strings.Repeat("[", 3*1024*1024-1000))
265298

266299
// Create JSON just under 3MB limit, not nested
267300
t.Run("create should handle a json document just under the maximum size with unbalanced nesting", func(t *testing.T) {
301+
if testing.Short() {
302+
t.Skip("skipping expensive test")
303+
}
268304
jsonBody := []byte(`{
269305
"apiVersion": "v1",
270306
"kind": "ConfigMap",

0 commit comments

Comments
 (0)