-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
mysql_ephemeral.go
57 lines (46 loc) · 1.98 KB
/
mysql_ephemeral.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
package image_ecosystem
import (
"fmt"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
e2e "k8s.io/kubernetes/test/e2e/framework"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[image_ecosystem][mysql][Slow] openshift mysql image", func() {
defer g.GinkgoRecover()
var (
templatePath = exutil.FixturePath("..", "..", "examples", "db-templates", "mysql-ephemeral-template.json")
oc = exutil.NewCLI("mysql-create", exutil.KubeConfigPath())
)
g.Context("", func() {
g.BeforeEach(func() {
exutil.DumpDockerInfo()
g.By("waiting for default service account")
err := exutil.WaitForServiceAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()), "default")
o.Expect(err).NotTo(o.HaveOccurred())
})
g.AfterEach(func() {
if g.CurrentGinkgoTestDescription().Failed {
exutil.DumpPodStates(oc)
exutil.DumpPodLogsStartingWith("", oc)
}
})
g.Describe("Creating from a template", func() {
g.It(fmt.Sprintf("should instantiate the template"), func() {
g.By(fmt.Sprintf("calling oc process -f %q", templatePath))
configFile, err := oc.Run("process").Args("-f", templatePath).OutputToFile("config.json")
o.Expect(err).NotTo(o.HaveOccurred())
g.By(fmt.Sprintf("calling oc create -f %q", configFile))
err = oc.Run("create").Args("-f", configFile).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
// oc.KubeFramework().WaitForAnEndpoint currently will wait forever; for now, prefacing with our WaitForADeploymentToComplete,
// which does have a timeout, since in most cases a failure in the service coming up stems from a failed deployment
err = exutil.WaitForDeploymentConfig(oc.KubeClient(), oc.AppsClient().AppsV1(), oc.Namespace(), "mysql", 1, true, oc)
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expecting the mysql service get endpoints")
err = e2e.WaitForEndpoint(oc.KubeFramework().ClientSet, oc.Namespace(), "mysql")
o.Expect(err).NotTo(o.HaveOccurred())
})
})
})
})