Skip to content

Commit dfc5864

Browse files
committed
Made the router test take Env variables to alter logging
Added new environment variables to help with debugging: - OPENSHIFT_LOG_LEVEL: Defaults to 4, but sets the debug level to the given value - OPENSHIFT_GET_ALL_DOCKER_LOGS: A boolean that enables dumping of all container logs if any container failed (rather than just giving the logs from the failure)
1 parent b10446e commit dfc5864

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/end-to-end/router_test.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -1348,10 +1348,15 @@ func createAndStartRouterContainerExtended(dockerCli *dockerClient.Client, maste
13481348
hostVols = append(hostVols, fmt.Sprintf("%[1]s:/usr/bin/openshift", binary))
13491349
}
13501350

1351+
logLevel := os.Getenv("OPENSHIFT_LOG_LEVEL")
1352+
if len(logLevel) == 0 {
1353+
logLevel = "4"
1354+
}
1355+
13511356
containerOpts := dockerClient.CreateContainerOptions{
13521357
Config: &dockerClient.Config{
13531358
Image: getRouterImage(),
1354-
Cmd: []string{"--master=" + masterIp, "--loglevel=4"},
1359+
Cmd: []string{"--master=" + masterIp, "--loglevel=" + logLevel},
13551360
Env: env,
13561361
ExposedPorts: exposedPorts,
13571362
VolumesFrom: vols,
@@ -1414,8 +1419,10 @@ func validateServer(server *tr.TestHttpService, t *testing.T) {
14141419

14151420
// cleanUp stops and removes the deployed router
14161421
func cleanUp(t *testing.T, dockerCli *dockerClient.Client, routerId string) {
1422+
getAllLogs, _ := strconv.ParseBool(os.Getenv("OPENSHIFT_GET_ALL_DOCKER_LOGS"))
1423+
14171424
dockerCli.StopContainer(routerId, 5)
1418-
if t.Failed() {
1425+
if t.Failed() || getAllLogs {
14191426
dockerCli.Logs(dockerClient.LogsOptions{
14201427
Container: routerId,
14211428
OutputStream: os.Stdout,

0 commit comments

Comments
 (0)