Skip to content

Commit

Permalink
Merge pull request #14217 from kargakis/remove-router-specific-env
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored May 19, 2017
2 parents b2d7377 + 76c5ce6 commit 5e6c6f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
1 change: 0 additions & 1 deletion hack/lib/util/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ function os::util::environment::setup_images_vars() {
export USE_IMAGES
fi
fi
export OPENSHIFT_ROUTER_IMAGE="$( component=haproxy-router eval "echo ${USE_IMAGES}" )"
export MAX_IMAGES_BULK_IMPORTED_PER_REPOSITORY="${MAX_IMAGES_BULK_IMPORTED_PER_REPOSITORY:-3}"
}
readonly -f os::util::environment::setup_images_vars
8 changes: 4 additions & 4 deletions test/extended/router/scoped.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ var _ = g.Describe("[Conformance][networking][router] openshift routers", func()
)

g.BeforeEach(func() {
image := os.Getenv("OPENSHIFT_ROUTER_IMAGE")
if len(image) == 0 {
g.Skip("Skipping HAProxy router tests, OPENSHIFT_ROUTER_IMAGE is unset")
imagePrefix := os.Getenv("OS_IMAGE_PREFIX")
if len(imagePrefix) == 0 {
imagePrefix = "openshift/origin"
}
err := oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:router", oc.Username()).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("new-app").Args("-f", configPath, "-p", "IMAGE="+image).Execute()
err = oc.Run("new-app").Args("-f", configPath, "-p", "IMAGE="+imagePrefix+"-haproxy-router").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
})

Expand Down
8 changes: 4 additions & 4 deletions test/extended/router/weighted.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ var _ = g.Describe("[Conformance][networking][router] weighted openshift router"
)

g.BeforeEach(func() {
image := os.Getenv("OPENSHIFT_ROUTER_IMAGE")
if len(image) == 0 {
g.Skip("Skipping HAProxy router tests, OPENSHIFT_ROUTER_IMAGE is unset")
imagePrefix := os.Getenv("OS_IMAGE_PREFIX")
if len(imagePrefix) == 0 {
imagePrefix = "openshift/origin"
}
err := oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:router", oc.Username()).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
err = oc.Run("new-app").Args("-f", configPath, "-p", "IMAGE="+image).Execute()
err = oc.Run("new-app").Args("-f", configPath, "-p", "IMAGE="+imagePrefix+"-haproxy-router").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
})

Expand Down
21 changes: 5 additions & 16 deletions test/integration/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ import (
)

const (
defaultRouterImage = "openshift/origin-haproxy-router"

defaultNamespace = "router-namespace"

tcWaitSeconds = 1
Expand Down Expand Up @@ -356,12 +354,6 @@ func TestRouter(t *testing.T) {
if err := waitForRoute(tc.routerUrl, tc.routeAlias, tc.protocol, nil, tc.expectedResponse); err != nil {
t.Errorf("TC %s failed: %v", tc.name, err)

// The following is related to the workaround above, q.v.
if getRouterImage() != defaultRouterImage {
t.Errorf("You may need to add an entry to /etc/hosts so that the"+
" hostname of the router (%s) resolves its the IP address, (%s).",
tc.routeAlias, routeAddress)
}
if strings.Contains(err.Error(), "unavailable the entire time") {
break
}
Expand Down Expand Up @@ -1439,16 +1431,13 @@ func cleanUp(t *testing.T, dockerCli *dockerClient.Client, routerId string) {
})
}

// getRouterImage is a utility that provides the router image to use by checking to see if OPENSHIFT_ROUTER_IMAGE is set
// or by using the default image
// getRouterImage is a utility that provides the router image to use by checking to see if OS_IMAGE_PREFIX is set
func getRouterImage() string {
i := os.Getenv("OPENSHIFT_ROUTER_IMAGE")

if len(i) == 0 {
i = defaultRouterImage
imagePrefix := os.Getenv("OS_IMAGE_PREFIX")
if len(imagePrefix) == 0 {
imagePrefix = "openshift/origin"
}

return i
return imagePrefix + "-haproxy-router"
}

// getRouteAddress checks for the OPENSHIFT_ROUTE_ADDRESS environment
Expand Down

0 comments on commit 5e6c6f7

Please sign in to comment.