• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang util.StartBuildAndWait函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/openshift/origin/test/extended/util.StartBuildAndWait函数的典型用法代码示例。如果您正苦于以下问题:Golang StartBuildAndWait函数的具体用法?Golang StartBuildAndWait怎么用?Golang StartBuildAndWait使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了StartBuildAndWait函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: doTest

func doTest(bldPrefix, debugStr string, same bool, oc *exutil.CLI) {
	// corrupt the builder image
	exutil.CorruptImage(fullImageName, corruptor)

	if bldPrefix == buildPrefixFC || bldPrefix == buildPrefixTC {
		// grant access to the custom build strategy
		err := oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:build-strategy-custom", oc.Username()).Execute()
		o.Expect(err).NotTo(o.HaveOccurred())
		defer func() {
			err = oc.AsAdmin().Run("adm").Args("policy", "remove-cluster-role-from-user", "system:build-strategy-custom", oc.Username()).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
		}()
	}

	// kick off the app/lang build and verify the builder image accordingly
	_, err := exutil.StartBuildAndWait(oc, bldPrefix)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())

	if same {
		exutil.VerifyImagesSame(fullImageName, corruptor, debugStr)
	} else {
		exutil.VerifyImagesDifferent(fullImageName, corruptor, debugStr)
	}

	// reset corrupted tagging for next test
	exutil.ResetImage(resetData)
	// dump tags/hexids for debug
	_, err = exutil.DumpAndReturnTagging(tags)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:30,代码来源:forcepull.go


示例2: doTest

func doTest(bldPrefix, debugStr string, same bool, oc *exutil.CLI) {
	// corrupt the builder image
	exutil.CorruptImage(fullImageName, corruptor)

	// kick off the app/lang build and verify the builder image accordingly
	_, err := exutil.StartBuildAndWait(oc, bldPrefix)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())

	if same {
		exutil.VerifyImagesSame(fullImageName, corruptor, debugStr)
	} else {
		exutil.VerifyImagesDifferent(fullImageName, corruptor, debugStr)
	}

	// reset corrupted tagging for next test
	exutil.ResetImage(resetData)
	// dump tags/hexids for debug
	_, err = exutil.DumpAndReturnTagging(tags)
	o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
}
开发者ID:abhgupta,项目名称:origin,代码行数:20,代码来源:forcepull.go


示例3:

		g.It("by creating slave from existing builder and adding it to Jenkins master", func() {

			g.By("create the jenkins slave builder template")
			err := oc.Run("create").Args("-f", jenkinsSlaveBuilderTemplate).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("create the jenkins master template")
			err = oc.Run("create").Args("-f", jenkinsMasterTemplate).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("instantiate the slave template")
			err = oc.Run("new-app").Args("--template", "jenkins-slave-builder").Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("build the Jenkins slave for ruby-22-centos7")
			br, err := exutil.StartBuildAndWait(oc, "ruby-22-centos7-jenkins-slave", "--wait", "--from-dir", "examples/jenkins/master-slave/slave")
			br.AssertSuccess()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("grant service account in jenkins container access to API")
			err = oc.Run("policy").Args("add-role-to-user", "edit", "system:serviceaccount:"+oc.Namespace()+":default", "-n", oc.Namespace()).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("instantiate the master template")
			err = oc.Run("new-app").Args("--template", "jenkins-master").Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("build the Jenkins master")
			br, err = exutil.StartBuildAndWait(oc, "jenkins-master", "--wait", "--from-dir", "examples/jenkins/master-slave")
			br.AssertSuccess()
			o.Expect(err).NotTo(o.HaveOccurred())
开发者ID:juanluisvaladas,项目名称:origin,代码行数:31,代码来源:kubernetes_plugin.go


示例4:

	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}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:30,代码来源:long_names.go


示例5:

	})

	g.Describe("S2I build from a template", func() {
		g.It(fmt.Sprintf("should create a image from %q template with proper Docker labels", stiBuildFixture), func() {
			oc.SetOutputDir(exutil.TestContext.OutputDir)

			g.By(fmt.Sprintf("calling oc create -f %q", imageStreamFixture))
			err := oc.Run("create").Args("-f", imageStreamFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By(fmt.Sprintf("calling oc create -f %q", stiBuildFixture))
			err = oc.Run("create").Args("-f", stiBuildFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting a test build")
			br, err := exutil.StartBuildAndWait(oc, "test")
			br.AssertSuccess()

			g.By("getting the Docker image reference from ImageStream")
			imageRef, err := exutil.GetDockerImageReference(oc.REST().ImageStreams(oc.Namespace()), "test", "latest")
			o.Expect(err).NotTo(o.HaveOccurred())

			imageLabels, err := eximages.GetImageLabels(oc.REST().ImageStreamImages(oc.Namespace()), "test", imageRef)
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("inspecting the new image for proper Docker labels")
			err = ExpectOpenShiftLabels(imageLabels)
			o.Expect(err).NotTo(o.HaveOccurred())
		})
	})
开发者ID:juanluisvaladas,项目名称:origin,代码行数:30,代码来源:labels.go


示例6:

	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("oc start-build source-build --wait", func() {
		g.It("Source: should start a build and wait for the build failed and build pod being killed by kubelet", func() {

			g.By("calling oc create source-build")
			err := oc.Run("create").Args("-f", sourceFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting the source build with --wait flag and short timeout")
			br, err := exutil.StartBuildAndWait(oc, "source-build", "--wait")
			o.Expect(br.StartBuildErr).To(o.HaveOccurred()) // start-build should detect the build error

			g.By("verifying the build status")
			o.Expect(br.BuildAttempt).To(o.BeTrue())                                            // the build should have been attempted
			o.Expect(br.Build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseFailed)) // the build should have failed

			g.By("verifying the build pod status")
			pod, err := oc.KubeREST().Pods(oc.Namespace()).Get(buildapi.GetBuildPodName(br.Build))
			o.Expect(err).NotTo(o.HaveOccurred())
			o.Expect(pod.Status.Phase).Should(o.BeEquivalentTo(kapi.PodFailed))
			o.Expect(pod.Status.Reason).Should(o.ContainSubstring("DeadlineExceeded"))

		})
	})
开发者ID:juanluisvaladas,项目名称:origin,代码行数:29,代码来源:completiondeadlineseconds.go


示例7:

	})
	g.Context("Pipeline with maven slave", func() {
		g.It("Should build and complete successfully", func() {
			// Deploy Jenkins
			g.By(fmt.Sprintf("calling oc new-app -f %q", jenkinsTemplatePath))
			err := oc.Run("new-app").Args("-f", jenkinsTemplatePath).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			// instantiate the template
			g.By(fmt.Sprintf("calling oc new-app -f %q", mavenSlavePipelinePath))
			err = oc.Run("new-app").Args("-f", mavenSlavePipelinePath).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			// start the build
			g.By("starting the pipeline build and waiting for it to complete")
			br, _ := exutil.StartBuildAndWait(oc, "openshift-jee-sample")
			br.AssertSuccess()

			// wait for the service to be running
			g.By("expecting the openshift-jee-sample service to be deployed and running")
			_, err = exutil.GetEndpointAddress(oc, "openshift-jee-sample")
			o.Expect(err).NotTo(o.HaveOccurred())
		})
	})

	g.Context("Orchestration pipeline", func() {
		g.It("Should build and complete successfully", func() {
			// Deploy Jenkins
			g.By(fmt.Sprintf("calling oc new-app -f %q", jenkinsTemplatePath))
			err := oc.Run("new-app").Args("-f", jenkinsTemplatePath).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
开发者ID:xgwang-zte,项目名称:origin,代码行数:31,代码来源:pipeline.go


示例8:

		buildFixture = exutil.FixturePath("testdata", "test-build-proxy.json")
		oc           = exutil.NewCLI("build-proxy", 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())
		oc.Run("create").Args("-f", buildFixture).Execute()
	})

	g.Describe("start build with broken proxy", func() {
		g.It("should start a build and wait for the build to to fail", func() {
			g.By("starting the build")

			br, _ := exutil.StartBuildAndWait(oc, "sample-build")
			br.AssertFailure()

			g.By("verifying the build sample-build-1 output")
			// The git ls-remote check should exit the build when the remote
			// repository is not accessible. It should never get to the clone.
			buildLog, err := br.Logs()
			o.Expect(err).NotTo(o.HaveOccurred())
			o.Expect(buildLog).NotTo(o.ContainSubstring("clone"))
			if !strings.Contains(buildLog, `unable to access 'https://github.com/openshift/ruby-hello-world.git/': Failed connect to 127.0.0.1:3128`) {
				fmt.Fprintf(g.GinkgoWriter, "\nbuild log:\n%s\n", buildLog)
			}
			o.Expect(buildLog).To(o.ContainSubstring(`unable to access 'https://github.com/openshift/ruby-hello-world.git/': Failed connect to 127.0.0.1:3128`))

			g.By("verifying the build sample-build-1 status")
			o.Expect(br.Build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseFailed))
开发者ID:abhgupta,项目名称:origin,代码行数:31,代码来源:proxy.go


示例9:

	})

	g.Describe("Building from a template", func() {
		g.It(fmt.Sprintf("should create a image from %q template and run it in a pod", stiEnvBuildFixture), func() {
			oc.SetOutputDir(exutil.TestContext.OutputDir)

			g.By(fmt.Sprintf("calling oc create -f %q", imageStreamFixture))
			err := oc.Run("create").Args("-f", imageStreamFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By(fmt.Sprintf("calling oc create -f %q", stiEnvBuildFixture))
			err = oc.Run("create").Args("-f", stiEnvBuildFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting a test build")
			br, _ := exutil.StartBuildAndWait(oc, "test")
			br.AssertSuccess()

			g.By("getting the Docker image reference from ImageStream")
			imageName, err := exutil.GetDockerImageReference(oc.REST().ImageStreams(oc.Namespace()), "test", "latest")
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("instantiating a pod and service with the new image")
			err = oc.Run("new-app").Args("-f", podAndServiceFixture, "-p", "IMAGE_NAME="+imageName).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("waiting for the service to become available")
			err = oc.KubeFramework().WaitForAnEndpoint(buildTestService)
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("expecting the pod container has TEST_ENV variable set")
开发者ID:abhgupta,项目名称:origin,代码行数:31,代码来源:s2i_env.go


示例10:

		// See this issue for details: https://github.com/openshift/origin/issues/10103
		err = exutil.WaitForAnImageStreamTag(oc, "openshift", "wildfly", "10.0")
		o.Expect(err).NotTo(o.HaveOccurred())
	})

	g.Describe("with scripts from the source repository", func() {
		oc.SetOutputDir(exutil.TestContext.OutputDir)

		g.It("should use assemble-runtime script from the source repository", func() {

			g.By("creating jvm-runner configuration")
			err := exutil.CreateResource(runnerConf, oc)
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("building jvm-runner image")
			br, _ := exutil.StartBuildAndWait(oc, "jvm-runner")
			br.AssertSuccess()

			g.By("creating build config")
			err = exutil.CreateResource(scriptsFromRepoBc, oc)
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("running the build")
			br, _ = exutil.StartBuildAndWait(oc, "java-extended-build-from-repo", "--build-loglevel=5")
			br.AssertSuccess()
			buildLog, err := br.Logs()
			if err != nil {
				e2e.Failf("Failed to fetch build logs: %v", err)
			}

			g.By("expecting that .s2i/bin/assemble-runtime was executed")
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:31,代码来源:s2i_extended_build.go


示例11:

	defer g.GinkgoRecover()
	var (
		dockerImageFixture = exutil.FixturePath("testdata", "test-docker-no-outputname.json")
		s2iImageFixture    = exutil.FixturePath("testdata", "test-s2i-no-outputname.json")
		oc                 = exutil.NewCLI("build-no-outputname", exutil.KubeConfigPath())
	)

	g.Describe("building from templates", func() {
		oc.SetOutputDir(exutil.TestContext.OutputDir)

		g.It(fmt.Sprintf("should create an image from %q docker template without an output image reference defined", dockerImageFixture), func() {
			err := oc.Run("create").Args("-f", dockerImageFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("expecting build to pass without an output image reference specified")
			br, err := exutil.StartBuildAndWait(oc, "test-docker")
			br.AssertSuccess()

			g.By("verifying the build test-docker-1 output")
			buildLog, err := br.Logs()
			fmt.Fprintf(g.GinkgoWriter, "\nBuild log:\n%s\n", buildLog)
			o.Expect(err).NotTo(o.HaveOccurred())
			o.Expect(buildLog).Should(o.ContainSubstring(`Build complete, no image push requested`))
		})

		g.It(fmt.Sprintf("should create an image from %q S2i template without an output image reference defined", s2iImageFixture), func() {
			err := oc.Run("create").Args("-f", s2iImageFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("expecting build to pass without an output image reference specified")
			br, err := exutil.StartBuildAndWait(oc, "test-sti")
开发者ID:juanluisvaladas,项目名称:origin,代码行数:31,代码来源:no_outputname.go


示例12:

			g.By("creating secret fixtures")
			err := oc.Run("create").Args("-f", secretsFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
			err = oc.Run("create").Args("-f", secondSecretsFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("creating test image stream")
			err = oc.Run("create").Args("-f", isFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("creating test build config")
			err = oc.Run("create").Args("-f", sourceBuildFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting the test source build")
			br, _ := exutil.StartBuildAndWait(oc, "test", "--from-dir", sourceBuildBinDir)
			br.AssertSuccess()

			g.By("getting the image name")
			image, err := exutil.GetDockerImageReference(oc.REST().ImageStreams(oc.Namespace()), "test", "latest")
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("verifying the build secrets were available during build and not present in the output image")
			pod := exutil.GetPodForContainer(kapi.Container{Name: "test", Image: image})
			oc.KubeFramework().TestContainerOutput("test-build-secret-source", pod, 0, []string{
				"testsecret/secret1=secret1",
				"testsecret/secret2=secret2",
				"testsecret/secret3=secret3",
				"testsecret2/secret1=secret1",
				"testsecret2/secret2=secret2",
				"testsecret2/secret3=secret3",
开发者ID:juanluisvaladas,项目名称:origin,代码行数:31,代码来源:secrets.go


示例13:

	defer g.GinkgoRecover()
	var (
		buildFixture = exutil.FixturePath("testdata", "test-nosrc-build.json")
		oc           = exutil.NewCLI("cli-build-nosrc", exutil.KubeConfigPath())
		exampleBuild = exutil.FixturePath("testdata", "test-build-app")
	)

	g.JustBeforeEach(func() {
		g.By("waiting for builder service account")
		err := exutil.WaitForBuilderAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()))
		o.Expect(err).NotTo(o.HaveOccurred())
		oc.Run("create").Args("-f", buildFixture).Execute()
	})

	g.Describe("started build", func() {
		g.It("should build even with an empty source in build config", func() {
			g.By("starting the empty source build")
			br, err := exutil.StartBuildAndWait(oc, "nosrc-build", fmt.Sprintf("--from-dir=%s", exampleBuild))
			br.AssertSuccess()

			g.By(fmt.Sprintf("verifying the status of %q", br.BuildPath))
			build, err := oc.Client().Builds(oc.Namespace()).Get(br.Build.Name)
			o.Expect(err).NotTo(o.HaveOccurred())
			o.Expect(build.Spec.Source.Dockerfile).To(o.BeNil())
			o.Expect(build.Spec.Source.Git).To(o.BeNil())
			o.Expect(build.Spec.Source.Images).To(o.BeNil())
			o.Expect(build.Spec.Source.Binary).NotTo(o.BeNil())
		})
	})
})
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:30,代码来源:nosrc.go


示例14:

	)

	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("s2i build with a rootable builder", func() {
		g.It("should not be able to switch to root with an assemble script", func() {

			g.By("calling oc new-build for rootable-builder")
			err := oc.Run("new-build").Args("--binary", "--name=rootable-ruby").Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting the rootable-ruby build")
			br, _ := exutil.StartBuildAndWait(oc, "rootable-ruby", fmt.Sprintf("--from-dir=%s", s2ibuilderFixture))
			br.AssertSuccess()

			g.By("creating a build that tries to gain root access via su")
			err = oc.Run("create").Args("-f", rootAccessBuildFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("start the root-access-build which attempts root access")
			br2, _ := exutil.StartBuildAndWait(oc, "root-access-build")
			br2.AssertFailure()
		})
	})

})
开发者ID:juanluisvaladas,项目名称:origin,代码行数:30,代码来源:s2i_dropcaps.go


示例15:

		binaryBuildDir           = exutil.FixturePath("testdata", "statusfail-assemble")
		oc                       = exutil.NewCLI("update-buildstatus", exutil.KubeConfigPath())
	)

	g.JustBeforeEach(func() {
		g.By("waiting for the builder service account")
		err := exutil.WaitForBuilderAccount(oc.KubeClient().ServiceAccounts(oc.Namespace()))
		o.Expect(err).NotTo(o.HaveOccurred())
	})

	g.Describe("Build status postcommit hook failure", func() {
		g.It("should contain the post commit hook failure reason and message", func() {
			err := oc.Run("create").Args("-f", postCommitHookFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			br, err := exutil.StartBuildAndWait(oc, "statusfail-postcommithook")
			o.Expect(err).NotTo(o.HaveOccurred())
			br.AssertFailure()

			build, err := oc.Client().Builds(oc.Namespace()).Get(br.Build.Name)
			o.Expect(err).NotTo(o.HaveOccurred())
			o.Expect(build.Status.Reason).To(o.Equal(buildapi.StatusReasonPostCommitHookFailed))
			o.Expect(build.Status.Message).To(o.Equal(buildapi.StatusMessagePostCommitHookFailed))
		})
	})

	g.Describe("Build status Docker fetch source failure", func() {
		g.It("should contain the Docker build fetch source failure reason and message", func() {
			err := oc.Run("create").Args("-f", fetchDockerSrc).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
开发者ID:php-coder,项目名称:origin,代码行数:30,代码来源:failure_status.go


示例16:

	g.JustBeforeEach(func() {
		g.By("waiting for builder service account")
		err := exutil.WaitForBuilderAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()))
		o.Expect(err).NotTo(o.HaveOccurred())
		oc.Run("create").Args("-f", buildFixture).Execute()

		g.By("waiting for istag to initialize")
		exutil.WaitForAnImageStreamTag(oc, oc.Namespace(), "busybox", "1")
	})

	g.Describe("testing postCommit hook", func() {

		g.It("successful postCommit script with args", func() {
			err := oc.Run("patch").Args("bc/busybox", "-p", "{\"spec\":{\"postCommit\":{\"script\":\"echo hello $1\",\"args\":[\"world\"],\"command\":null}}}").Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
			br, _ := exutil.StartBuildAndWait(oc, "busybox")
			br.AssertSuccess()
			o.Expect(br.Logs()).To(o.ContainSubstring("hello world"))
		})

		g.It("successful postCommit explicit command", func() {
			err := oc.Run("patch").Args("bc/busybox", "-p", "{\"spec\":{\"postCommit\":{\"command\":[\"sh\",\"-c\"],\"args\":[\"echo explicit command\"],\"script\":\"\"}}}").Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
			br, _ := exutil.StartBuildAndWait(oc, "busybox")
			br.AssertSuccess()
			o.Expect(br.Logs()).To(o.ContainSubstring("explicit command"))
		})

		g.It("successful postCommit default entrypoint", func() {
			err := oc.Run("patch").Args("bc/busybox", "-p", "{\"spec\":{\"postCommit\":{\"args\":[\"echo\",\"default entrypoint\"],\"command\":null,\"script\":\"\"}}}").Execute()
			o.Expect(err).NotTo(o.HaveOccurred())
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:31,代码来源:hooks.go


示例17:

	g.JustBeforeEach(func() {
		g.By("waiting for builder service account")
		err := exutil.WaitForBuilderAccount(oc.AdminKubeREST().ServiceAccounts(oc.Namespace()))
		o.Expect(err).NotTo(o.HaveOccurred())
	})

	g.Describe("Building from a template", func() {
		g.It("should create an s2i build with a quota and run it", func() {
			oc.SetOutputDir(exutil.TestContext.OutputDir)

			g.By(fmt.Sprintf("calling oc create -f %q", buildFixture))
			err := oc.Run("create").Args("-f", buildFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting a test build")
			br, _ := exutil.StartBuildAndWait(oc, "s2i-build-quota", "--from-dir", exutil.FixturePath("testdata", "build-quota"))
			br.AssertSuccess()

			g.By("expecting the build logs to contain the correct cgroups values")
			buildLog, err := br.Logs()
			o.Expect(err).NotTo(o.HaveOccurred())
			o.Expect(buildLog).To(o.ContainSubstring("MEMORY=209715200"))
			o.Expect(buildLog).To(o.ContainSubstring("MEMORYSWAP=209715200"))
			o.Expect(buildLog).To(o.ContainSubstring("SHARES=61"))
			o.Expect(buildLog).To(o.ContainSubstring("PERIOD=100000"))
			o.Expect(buildLog).To(o.ContainSubstring("QUOTA=6000"))
		})
	})
})
开发者ID:juanluisvaladas,项目名称:origin,代码行数:29,代码来源:s2i_quota.go


示例18:

	})

	g.Describe("Building from a template", func() {
		g.It(fmt.Sprintf("should create a image from %q template and run it in a pod", stiEnvBuildFixture), func() {
			oc.SetOutputDir(exutil.TestContext.OutputDir)

			g.By(fmt.Sprintf("calling oc create -f %q", imageStreamFixture))
			err := oc.Run("create").Args("-f", imageStreamFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By(fmt.Sprintf("calling oc create -f %q", stiEnvBuildFixture))
			err = oc.Run("create").Args("-f", stiEnvBuildFixture).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting a test build")
			br, _ := exutil.StartBuildAndWait(oc, "test", "--from-dir", "test/extended/testdata/sti-environment-build-app")
			br.AssertSuccess()

			g.By("getting the Docker image reference from ImageStream")
			imageName, err := exutil.GetDockerImageReference(oc.Client().ImageStreams(oc.Namespace()), "test", "latest")
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("instantiating a pod and service with the new image")
			err = oc.Run("new-app").Args("-f", podAndServiceFixture, "-p", "IMAGE_NAME="+imageName).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("waiting for the service to become available")
			err = oc.KubeFramework().WaitForAnEndpoint(buildTestService)
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("expecting the pod container has TEST_ENV variable set")
开发者ID:LalatenduMohanty,项目名称:origin,代码行数:31,代码来源:s2i_env.go


示例19:

	g.Context("Manual deploy the jenkins and trigger a jenkins pipeline build", func() {
		g.It("JenkinsPipeline build should succeed when manual deploy the jenkins service", func() {
			oc.SetOutputDir(exutil.TestContext.OutputDir)

			g.By(fmt.Sprintf("calling oc new-app -f %q", jenkinsTemplatePath))
			err := oc.Run("new-app").Args("-f", jenkinsTemplatePath).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			//wait for the jenkins deployment complete
			g.By("waiting the jenkins service deployed")
			err = exutil.WaitForADeploymentToComplete(oc.KubeREST().ReplicationControllers(oc.Namespace()), "jenkins", oc)
			if err != nil {
				exutil.DumpDeploymentLogs("jenkins", oc)
			}
			o.Expect(err).NotTo(o.HaveOccurred())
			// create the pipeline build example
			g.By(fmt.Sprintf("calling oc new-app -f %q", pipelineTemplatePath))
			err = oc.Run("new-app").Args("-f", pipelineTemplatePath).Execute()
			o.Expect(err).NotTo(o.HaveOccurred())

			g.By("starting a pipeline build")
			br, _ := exutil.StartBuildAndWait(oc, "sample-pipeline")
			if !br.BuildSuccess {
				exutil.DumpDeploymentLogs("jenkins", oc)
			}
			br.AssertSuccess()
		})
	})

})
开发者ID:juanluisvaladas,项目名称:origin,代码行数:30,代码来源:pipeline.go


示例20:

	var oc = exutil.NewCLI("forcepull", exutil.KubeConfigPath())

	g.BeforeEach(func() {

		g.By("refresh corruptor, prep forcepull builder")
		exutil.PullImage(corruptor, dockerClient.AuthConfiguration{})

		exutil.DumpImage(corruptor)

		// create the image streams and build configs for a test case specific builders
		setupPath := exutil.FixturePath("testdata", "forcepull-setup.json")
		err := exutil.CreateResource(setupPath, oc)

		// kick off the build for the new builder image just for force pull so we can corrupt them without conflicting with
		// any other tests potentially running in parallel
		br, _ := exutil.StartBuildAndWait(oc, bldrPrefix)
		br.AssertSuccess()

		serviceIP, err := oc.Run("get").Args("svc", "docker-registry", "-n", "default", "--config", exutil.KubeConfigPath()).Template("{{.spec.clusterIP}}").Output()
		o.Expect(err).NotTo(o.HaveOccurred())
		port, err := oc.Run("get").Args("svc", "docker-registry", "-n", "default", "--config", exutil.KubeConfigPath()).Template("{{ $x := index .spec.ports 0}}{{$x.port}}").Output()
		o.Expect(err).NotTo(o.HaveOccurred())
		g.By(fmt.Sprintf("docker-registry service IP is %s and port %s ", serviceIP, port))

		// get the auth so we can pull the build image from the internal docker registry since the builder controller will  remove it
		// from the docker daemon cache when the docker build completes;
		authCfg, err = exutil.BuildAuthConfiguration(serviceIP+":"+port, oc)

		// now actually pull the image back in from the openshift internal docker registry
		fullImageName = authCfg.ServerAddress + "/" + oc.Namespace() + "/" + bldr
		err = exutil.PullImage(fullImageName, *authCfg)
开发者ID:juanluisvaladas,项目名称:origin,代码行数:31,代码来源:forcepull.go



注:本文中的github.com/openshift/origin/test/extended/util.StartBuildAndWait函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang util.WaitForABuild函数代码示例发布时间:2022-05-28
下一篇:
Golang util.SetupHostPathVolumes函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap