Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion hack/test-integration-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ trap cleanup EXIT SIGINT
echo
echo Docker integration test cases ...
echo
KUBE_RACE="${KUBE_RACE:--race}" KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration docker' "${@:1}"
# A long timeout is set here in case the docker images do not exist. To speed execution of this test
# either pre-build or pre-pull the docker images that are being used.
KUBE_TIMEOUT="-timeout 600s" KUBE_RACE="${KUBE_RACE:--race}" KUBE_COVER=" " "${OS_ROOT}/hack/test-go.sh" test/integration -tags 'integration docker' "${@:1}"
33 changes: 32 additions & 1 deletion test/integration/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
tr "github.com/openshift/origin/test/integration/router"
)

const defaultRouterImage = "openshift/origin-haproxy-router"
const defaultRouterImage = "openshift/origin-haproxy-router:latest"

// init ensures docker exists for this test
func init() {
Expand Down Expand Up @@ -233,6 +233,12 @@ func createAndStartRouterContainer(dockerCli *dockerClient.Client, masterIp stri
},
}

err = pullIfNotPresent(dockerCli, getRouterImage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just fail hard here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was failing hard. I added this in so it wouldn't. If we're ok with the failure then this PR can be closed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok if it fails hard, and it's clear why.

----- Original Message -----

@@ -233,6 +233,12 @@ func createAndStartRouterContainer(dockerCli
*dockerClient.Client, masterIp stri
},
}

  • err = pullIfNotPresent(dockerCli, getRouterImage())

It was failing hard. I added this in so it wouldn't. If we're ok with the
failure then this PR can be closed.


Reply to this email directly or view it on GitHub:
https://github.com/openshift/origin/pull/879/files#r24108382

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10-4, closing. It would give a message that the image didn't exist.


if err != nil {
return "", err
}

container, err := dockerCli.CreateContainer(containerOpts)

if err != nil {
Expand Down Expand Up @@ -270,6 +276,31 @@ func createAndStartRouterContainer(dockerCli *dockerClient.Client, masterIp stri
return container.ID, nil
}

// pullIfNotPresent checks for a docker image and tries to pull it if it receives a 'no such image' error
func pullIfNotPresent(dockerCli *dockerClient.Client, image string) error {
_, err := dockerCli.InspectImage(image)

if err != nil {
if err.Error() == "no such image" {
pio := dockerClient.PullImageOptions{
Repository: image,
}

auth := dockerClient.AuthConfiguration{}

e := dockerCli.PullImage(pio, auth)

if e != nil {
return e
}
} else {
return err
}
}

return nil
}

// validateServer performs a basic run through by validating each of the configured urls for the simulator to
// ensure they are responding
func validateServer(server *tr.TestHttpService, t *testing.T) {
Expand Down