-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_app.go
72 lines (59 loc) · 2.56 KB
/
new_app.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
package builds
import (
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
deployutil "github.com/openshift/origin/test/extended/deployments"
exutil "github.com/openshift/origin/test/extended/util"
)
const (
a58 = "a234567890123456789012345678901234567890123456789012345678"
a59 = "a2345678901234567890123456789012345678901234567890123456789"
)
var _ = g.Describe("[Feature:Builds][Conformance] oc new-app", func() {
// Previously, the maximum length of app names creatable by new-app has
// inadvertently been decreased, e.g. by creating an annotation somewhere
// whose name itself includes the app name. Ensure we can create and fully
// deploy an app with a 58 character name [63 maximum - len('-9999' suffix)].
oc := exutil.NewCLI("new-app", exutil.KubeConfigPath())
g.Context("", func() {
g.BeforeEach(func() {
exutil.PreTestDump()
})
g.JustBeforeEach(func() {
g.By("waiting for openshift namespace imagestreams")
err := exutil.WaitForOpenShiftNamespaceImageStreams(oc)
o.Expect(err).NotTo(o.HaveOccurred())
})
g.AfterEach(func() {
if g.CurrentGinkgoTestDescription().Failed {
exutil.DumpPodStates(oc)
exutil.DumpConfigMapStates(oc)
exutil.DumpPodLogsStartingWith("", oc)
}
deployutil.DeploymentConfigFailureTrap(oc, a58, g.CurrentGinkgoTestDescription().Failed)
deployutil.DeploymentConfigFailureTrap(oc, a59, g.CurrentGinkgoTestDescription().Failed)
})
g.It("should succeed with a --name of 58 characters", func() {
g.Skip("TODO: disabled due to https://bugzilla.redhat.com/show_bug.cgi?id=1702743")
g.By("calling oc new-app")
err := oc.Run("new-app").Args("https://github.com/sclorg/nodejs-ex", "--name", a58).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for the build to complete")
err = exutil.WaitForABuild(oc.BuildClient().BuildV1().Builds(oc.Namespace()), a58+"-1", nil, nil, nil)
if err != nil {
exutil.DumpBuildLogs(a58, oc)
}
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for the deployment to complete")
err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), a58, 1, true, oc)
o.Expect(err).NotTo(o.HaveOccurred())
})
g.It("should fail with a --name longer than 58 characters", func() {
g.Skip("TODO: disabled due to https://bugzilla.redhat.com/show_bug.cgi?id=1702743")
g.By("calling oc new-app")
out, err := oc.Run("new-app").Args("https://github.com/sclorg/nodejs-ex", "--name", a59).Output()
o.Expect(err).To(o.HaveOccurred())
o.Expect(out).To(o.ContainSubstring("error: invalid name: "))
})
})
})