Merge pull request #92879 from liggitt/short-integration-tests

Skip expensive integration tests in short run mode
This commit is contained in:
Kubernetes Prow Robot 2020-07-11 20:57:52 -07:00 committed by GitHub
commit 888255bf3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 0 deletions

View File

@ -80,6 +80,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
// Create YAML just under 3MB limit, nested
t.Run("create YAML doc under limit, nested", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
yamlBody := []byte(fmt.Sprintf(`
apiVersion: %s
kind: %s
@ -100,6 +103,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
// Create YAML just under 3MB limit, not nested
t.Run("create YAML doc under limit, not nested", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
yamlBody := []byte(fmt.Sprintf(`
apiVersion: %s
kind: %s
@ -141,6 +147,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
// Create JSON just under 3MB limit, nested
t.Run("create JSON doc under limit, nested", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
jsonBody := []byte(fmt.Sprintf(`{
"apiVersion": %q,
"kind": %q,
@ -162,6 +171,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
// Create JSON just under 3MB limit, not nested
t.Run("create JSON doc under limit, not nested", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
jsonBody := []byte(fmt.Sprintf(`{
"apiVersion": %q,
"kind": %q,
@ -191,6 +203,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
}
t.Run("JSONPatchType nested patch under limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`[{"op":"add","path":"/foo","value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}]`)
err = rest.Patch(types.JSONPatchType).AbsPath("/apis", noxuDefinition.Spec.Group, noxuDefinition.Spec.Version, noxuDefinition.Spec.Names.Plural, "test").
Body(patchBody).Do(context.TODO()).Error()
@ -199,6 +214,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
}
})
t.Run("MergePatchType nested patch under limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
err = rest.Patch(types.MergePatchType).AbsPath("/apis", noxuDefinition.Spec.Group, noxuDefinition.Spec.Version, noxuDefinition.Spec.Names.Plural, "test").
Body(patchBody).Do(context.TODO()).Error()
@ -207,6 +225,9 @@ values: `+strings.Repeat("[", 3*1024*1024), apiVersion, kind))
}
})
t.Run("ApplyPatchType nested patch under limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath("/apis", noxuDefinition.Spec.Group, noxuDefinition.Spec.Version, noxuDefinition.Spec.Names.Plural, "test").
Body(patchBody).Do(context.TODO()).Error()

View File

@ -85,6 +85,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("JSONPatchType should handle a patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`[{"op":"add","path":"/foo","value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}]`)
err = rest.Patch(types.JSONPatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -93,6 +96,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("JSONPatchType should handle a valid patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`[{"op":"add","path":"/foo","value":0` + strings.Repeat(" ", 3*1024*1024-100) + `}]`)
err = rest.Patch(types.JSONPatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -101,6 +107,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("MergePatchType should handle a patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
err = rest.Patch(types.MergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -109,6 +118,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("MergePatchType should handle a valid patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":0` + strings.Repeat(" ", 3*1024*1024-100) + `}`)
err = rest.Patch(types.MergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -117,6 +129,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("StrategicMergePatchType should handle a patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
err = rest.Patch(types.StrategicMergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -125,6 +140,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("StrategicMergePatchType should handle a valid patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":0` + strings.Repeat(" ", 3*1024*1024-100) + `}`)
err = rest.Patch(types.StrategicMergePatchType).AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -133,6 +151,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("ApplyPatchType should handle a patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"value":` + strings.Repeat("[", 3*1024*1024/2-100) + strings.Repeat("]", 3*1024*1024/2-100) + `}`)
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -141,6 +162,9 @@ func TestMaxResourceSize(t *testing.T) {
}
})
t.Run("ApplyPatchType should handle a valid patch just under the max limit", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
patchBody := []byte(`{"apiVersion":"v1","kind":"Secret"` + strings.Repeat(" ", 3*1024*1024-100) + `}`)
err = rest.Patch(types.ApplyPatchType).Param("fieldManager", "test").AbsPath("/api/v1/namespaces/default/secrets/test").
Body(patchBody).Do(context.TODO()).Error()
@ -182,6 +206,9 @@ values: ` + strings.Repeat("[", 3*1024*1024))
// Create YAML just under 3MB limit, nested
t.Run("create should handle a yaml document just under the maximum size with correct nesting", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
yamlBody := []byte(`
apiVersion: v1
kind: ConfigMap
@ -202,6 +229,9 @@ values: ` + strings.Repeat("[", 3*1024*1024/2-500) + strings.Repeat("]", 3*1024*
// Create YAML just under 3MB limit, not nested
t.Run("create should handle a yaml document just under the maximum size with unbalanced nesting", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
yamlBody := []byte(`
apiVersion: v1
kind: ConfigMap
@ -243,6 +273,9 @@ values: ` + strings.Repeat("[", 3*1024*1024-1000))
// Create JSON just under 3MB limit, nested
t.Run("create should handle a json document just under the maximum size with correct nesting", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
jsonBody := []byte(`{
"apiVersion": "v1",
"kind": "ConfigMap",
@ -265,6 +298,9 @@ values: ` + strings.Repeat("[", 3*1024*1024-1000))
// Create JSON just under 3MB limit, not nested
t.Run("create should handle a json document just under the maximum size with unbalanced nesting", func(t *testing.T) {
if testing.Short() {
t.Skip("skipping expensive test")
}
jsonBody := []byte(`{
"apiVersion": "v1",
"kind": "ConfigMap",