forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
long_names.go
81 lines (61 loc) · 2.95 KB
/
long_names.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package builds
import (
"path/filepath"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[Feature:Builds][Slow] extremely long build/bc names are not problematic", func() {
defer g.GinkgoRecover()
var (
testDataBaseDir = exutil.FixturePath("testdata", "long_names")
longNamesFixture = filepath.Join(testDataBaseDir, "fixture.json")
oc = exutil.NewCLI("long-names", exutil.KubeConfigPath())
)
g.Describe("build with long names", func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.It("delete builds with long names without collateral damage", func() {
g.By("creating long_names fixtures")
err := oc.Run("create").Args("-f", longNamesFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
// Names can be a maximum of 253 chars. These build config names are 201 (to allow for suffixes appiled during the test process, e.g. -1, -2 for builds and log filenames)
// and the names differ only in the last character.
bcA := "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890a"
bcB := "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890b"
g.By("starting long name build config A-1")
brA1, err := exutil.StartBuildAndWait(oc, bcA)
brA1.AssertSuccess()
g.By("starting long name build config B-1")
brB1, err := exutil.StartBuildAndWait(oc, bcB)
brB1.AssertSuccess()
g.By("starting long name build config A-2")
brA2, err := exutil.StartBuildAndWait(oc, bcA)
brA2.AssertSuccess()
g.By("starting long name build config B-2")
brB2, err := exutil.StartBuildAndWait(oc, bcB)
brB2.AssertSuccess()
builds := [...]*exutil.BuildResult{brA1, brB1, brA2, brB2}
g.By("Verifying gets for build configs and builds")
for _, br := range builds {
err = oc.Run("get").Args(br.BuildPath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
g.By("Deleting build config B (which should cascade to builds it created)")
err = oc.Run("delete").Args("bc", bcB).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("get").Args("bc", bcB).Execute()
o.Expect(err).To(o.HaveOccurred())
err = oc.Run("get").Args(brB1.BuildPath).Execute()
o.Expect(err).To(o.HaveOccurred())
err = oc.Run("get").Args(brB2.BuildPath).Execute()
o.Expect(err).To(o.HaveOccurred())
g.By("Verifying build config A was untouched by delete")
err = oc.Run("get").Args("bc", bcA).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("get").Args(brA1.BuildPath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("get").Args(brA2.BuildPath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
})
})
})