Exemple #1
0
	buildName   = buildPrefix + "-1"
	s2iDockBldr = "docker.io/openshift/ruby-20-centos7"
	custBldr    = "docker.io/openshift/origin-custom-docker-builder"
)

/*
If docker.io is not responding to requests in a timely manner, this test suite will be adversely affected.

If you suspect such a situation, attempt pulling some openshift images other than ruby-20-centos7 or origin-custom-docker-builder
while this test is running and compare results.  Restarting your docker daemon, assuming you can ping docker.io quickly, could
be a quick fix.
*/

var _ = g.BeforeSuite(func() {
	// do a pull initially just to insure have the latest version
	exutil.PullImage(s2iDockBldr)
	exutil.PullImage(custBldr)
	// save hex image IDs for image reset after corruption
	tags := []string{s2iDockBldr + ":latest", custBldr + ":latest"}
	hexIDs, ierr := exutil.GetImageIDForTags(tags)
	o.Expect(ierr).NotTo(o.HaveOccurred())
	for _, hexID := range hexIDs {
		g.By(fmt.Sprintf("\n%s FORCE PULL TEST:  hex id %s ", time.Now().Format(time.RFC850), hexID))
	}
	o.Expect(len(hexIDs)).To(o.Equal(2))
	resetData = map[string]string{s2iDockBldr: hexIDs[0], custBldr: hexIDs[1]}
	g.By(fmt.Sprintf("\n%s FORCE PULL TEST:  hex id for s2i/docker %s and for custom %s ", time.Now().Format(time.RFC850), hexIDs[0], hexIDs[1]))
})

// TODO this seems like a weird restriction with segregated namespaces.  provide a better explanation of why this doesn't work
// we don't run in parallel with this suite - do not want different tests tagging the same image in different ways at the same time
Exemple #2
0
Also, in order to build the test case specific builder images only once, we currently have to do all the testing within a single g.It block.
The project/namespace were being destroyed between tests, and that includes removal of the specific builder images
we built.  The credentials also are recycled between those points.

Dumping of the ImageStreams and Secrets JSON output at the various points proved this out.
*/

var _ = g.Describe("[LocalNode][builds] forcePull should affect pulling builder images", func() {
	defer g.GinkgoRecover()
	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()