本文整理汇总了Golang中github.com/openshift/origin/test/extended/util.CheckOpenShiftNamespaceImageStreams函数的典型用法代码示例。如果您正苦于以下问题:Golang CheckOpenShiftNamespaceImageStreams函数的具体用法?Golang CheckOpenShiftNamespaceImageStreams怎么用?Golang CheckOpenShiftNamespaceImageStreams使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckOpenShiftNamespaceImageStreams函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewSampleRepoTest
// NewSampleRepoTest creates a function for a new ginkgo test case that will instantiate a template
// from a url, kick off the buildconfig defined in that template, wait for the build/deploy,
// and then confirm the application is serving an expected string value.
func NewSampleRepoTest(c SampleRepoConfig) func() {
return func() {
defer g.GinkgoRecover()
var oc = exutil.NewCLI(c.repoName+"-repo-test", exutil.KubeConfigPath())
g.JustBeforeEach(func() {
g.By("Waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("Building "+c.repoName+" app from new-app", func() {
g.It(fmt.Sprintf("should build a "+c.repoName+" image and run it in a pod"), func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
exutil.CheckOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc new-app with the " + c.repoName + " example template"))
err := oc.Run("new-app").Args("-f", c.templateURL).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
// all the templates automatically start a build.
buildName := c.buildConfigName + "-1"
g.By("expecting the build is in the Complete phase")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), buildName, exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs(c.buildConfigName, oc)
}
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expecting the app deployment to be complete")
err = exutil.WaitForADeploymentToComplete(oc.KubeREST().ReplicationControllers(oc.Namespace()), c.deploymentConfigName, oc)
o.Expect(err).NotTo(o.HaveOccurred())
if len(c.dbDeploymentConfigName) > 0 {
g.By("expecting the db deployment to be complete")
err = exutil.WaitForADeploymentToComplete(oc.KubeREST().ReplicationControllers(oc.Namespace()), c.dbDeploymentConfigName, oc)
o.Expect(err).NotTo(o.HaveOccurred())
}
g.By("expecting the service is available")
serviceIP, err := oc.Run("get").Args("service", c.serviceName).Template("{{ .spec.clusterIP }}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(serviceIP).ShouldNot(o.Equal(""))
g.By("expecting an endpoint is available")
err = oc.KubeFramework().WaitForAnEndpoint(c.serviceName)
o.Expect(err).NotTo(o.HaveOccurred())
g.By("verifying string from app request")
response, err := exutil.FetchURL("http://"+serviceIP+":8080"+c.appPath, time.Duration(30*time.Second))
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(response).Should(o.ContainSubstring(c.expectedString))
})
})
}
}
开发者ID:sgallagher,项目名称:origin,代码行数:60,代码来源:sample_repos.go
示例2:
var _ = g.Describe("[image_ecosystem][perl][Slow] hot deploy for openshift perl image", func() {
defer g.GinkgoRecover()
var (
dancerTemplate = "https://raw.githubusercontent.com/openshift/dancer-ex/master/openshift/templates/dancer-mysql.json"
oc = exutil.NewCLI("s2i-perl", exutil.KubeConfigPath())
modifyCommand = []string{"sed", "-ie", `s/data => \$data\[0\]/data => "1337"/`, "lib/default.pm"}
pageCountFn = func(count int) string { return fmt.Sprintf(`<span class="code" id="count-value">%d</span>`, count) }
dcName = "dancer-mysql-example-1"
dcLabel = exutil.ParseLabelsOrDie(fmt.Sprintf("deployment=%s", dcName))
)
g.Describe("Dancer example", func() {
g.It(fmt.Sprintf("should work with hot deploy"), func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
exutil.CheckOpenShiftNamespaceImageStreams(oc)
g.By(fmt.Sprintf("calling oc new-app -f %q", dancerTemplate))
err := oc.Run("new-app").Args("-f", dancerTemplate).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for build to finish")
err = exutil.WaitForABuild(oc.Client().Builds(oc.Namespace()), "dancer-mysql-example-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
exutil.DumpBuildLogs("dancer-mysql-example", oc)
}
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.WaitForADeploymentToComplete(oc.KubeClient().Core().ReplicationControllers(oc.Namespace()), "dancer-mysql-example", oc)
o.Expect(err).NotTo(o.HaveOccurred())
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:31,代码来源:s2i_perl.go
示例3: replicationTestFactory
func replicationTestFactory(oc *exutil.CLI, tc testCase) func() {
return func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
defer cleanup(oc)
_, err := exutil.SetupHostPathVolumes(oc.AdminKubeClient().Core().PersistentVolumes(), oc.Namespace(), "1Gi", 2)
o.Expect(err).NotTo(o.HaveOccurred())
err = testutil.WaitForPolicyUpdate(oc.Client(), oc.Namespace(), "create", templateapi.Resource("templates"), true)
o.Expect(err).NotTo(o.HaveOccurred())
exutil.CheckOpenShiftNamespaceImageStreams(oc)
err = oc.Run("new-app").Args("-f", tc.TemplatePath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("new-app").Args("-f", helperTemplate, "-p", fmt.Sprintf("DATABASE_SERVICE_NAME=%s", helperName)).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
g.By("waiting for the deployment to complete")
err = exutil.WaitForADeploymentToComplete(oc.KubeClient().Core().ReplicationControllers(oc.Namespace()), helperName, oc)
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for an endpoint")
err = oc.KubeFramework().WaitForAnEndpoint(helperName)
o.Expect(err).NotTo(o.HaveOccurred())
tableCounter := 0
assertReplicationIsWorking := func(masterDeployment, slaveDeployment string, slaveCount int) (exutil.Database, []exutil.Database, exutil.Database) {
tableCounter++
table := fmt.Sprintf("table_%0.2d", tableCounter)
g.By("creating replication helpers")
master, slaves, helper := CreateMySQLReplicationHelpers(oc.KubeClient().Core().Pods(oc.Namespace()), masterDeployment, slaveDeployment, fmt.Sprintf("%s-1", helperName), slaveCount)
o.Expect(exutil.WaitUntilAllHelpersAreUp(oc, []exutil.Database{master, helper})).NotTo(o.HaveOccurred())
o.Expect(exutil.WaitUntilAllHelpersAreUp(oc, slaves)).NotTo(o.HaveOccurred())
// Test if we can query as root
g.By("wait for mysql-master endpoint")
oc.KubeFramework().WaitForAnEndpoint("mysql-master")
err := helper.TestRemoteLogin(oc, "mysql-master")
o.Expect(err).NotTo(o.HaveOccurred())
// Create a new table with random name
g.By("create new table")
_, err = master.Query(oc, fmt.Sprintf("CREATE TABLE %s (col1 VARCHAR(20), col2 VARCHAR(20));", table))
o.Expect(err).NotTo(o.HaveOccurred())
// Write new data to the table through master
_, err = master.Query(oc, fmt.Sprintf("INSERT INTO %s (col1, col2) VALUES ('val1', 'val2');", table))
o.Expect(err).NotTo(o.HaveOccurred())
// Make sure data is present on master
err = exutil.WaitForQueryOutputContains(oc, master, 10*time.Second, false, fmt.Sprintf("SELECT * FROM %s\\G;", table), "col1: val1\ncol2: val2")
o.Expect(err).NotTo(o.HaveOccurred())
// Make sure data was replicated to all slaves
for _, slave := range slaves {
err = exutil.WaitForQueryOutputContains(oc, slave, 90*time.Second, false, fmt.Sprintf("SELECT * FROM %s\\G;", table), "col1: val1\ncol2: val2")
o.Expect(err).NotTo(o.HaveOccurred())
}
return master, slaves, helper
}
g.By("after initial deployment")
master, _, _ := assertReplicationIsWorking("mysql-master-1", "mysql-slave-1", 1)
if tc.SkipReplication {
return
}
g.By("after master is restarted by changing the Deployment Config")
err = oc.Run("env").Args("dc", "mysql-master", "MYSQL_ROOT_PASSWORD=newpass").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.WaitUntilPodIsGone(oc.KubeClient().Core().Pods(oc.Namespace()), master.PodName(), 1*time.Minute)
master, _, _ = assertReplicationIsWorking("mysql-master-2", "mysql-slave-1", 1)
g.By("after master is restarted by deleting the pod")
err = oc.Run("delete").Args("pod", "-l", "deployment=mysql-master-2").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.WaitUntilPodIsGone(oc.KubeClient().Core().Pods(oc.Namespace()), master.PodName(), 1*time.Minute)
o.Expect(err).NotTo(o.HaveOccurred())
_, slaves, _ := assertReplicationIsWorking("mysql-master-2", "mysql-slave-1", 1)
g.By("after slave is restarted by deleting the pod")
err = oc.Run("delete").Args("pod", "-l", "deployment=mysql-slave-1").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = exutil.WaitUntilPodIsGone(oc.KubeClient().Core().Pods(oc.Namespace()), slaves[0].PodName(), 1*time.Minute)
o.Expect(err).NotTo(o.HaveOccurred())
assertReplicationIsWorking("mysql-master-2", "mysql-slave-1", 1)
pods, err := oc.KubeClient().Core().Pods(oc.Namespace()).List(kapi.ListOptions{LabelSelector: exutil.ParseLabelsOrDie("deployment=mysql-slave-1")})
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(len(pods.Items)).To(o.Equal(1))
// NOTE: Commented out, current template does not support multiple replicas.
/*
g.By("after slave is scaled to 0 and then back to 4 replicas")
//.........这里部分代码省略.........
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:101,代码来源:mysql_replica.go
注:本文中的github.com/openshift/origin/test/extended/util.CheckOpenShiftNamespaceImageStreams函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论