Skip to content

Commit

Permalink
Fix #1255: disable on openshift and add init-container dump
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Feb 21, 2020
1 parent b66029b commit 6689759
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions e2e/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,27 @@ limitations under the License.
package e2e

import (
"os"
"testing"
"time"

"github.com/apache/camel-k/pkg/util/openshift"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
v1 "k8s.io/api/core/v1"
)

func TestRunGlobalInstall(t *testing.T) {
forceGlobalTest := os.Getenv("CAMEL_K_FORCE_GLOBAL_TEST") == "true"
if !forceGlobalTest {
ocp, err := openshift.IsOpenShift(testClient)
assert.Nil(t, err)
if ocp {
t.Skip("Prefer not to run on OpenShift to avoid giving more permissions to the user running tests")
return
}
}

withNewTestNamespace(t, func(ns string) {
Expect(kamel("install", "-n", ns, "--global").Execute()).Should(BeNil())

Expand Down
5 changes: 4 additions & 1 deletion e2e/util/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ func Dump(c client.Client, ns string, t *testing.T) error {
t.Logf("name=%s\n", pod.Name)
dumpConditions(" ", pod.Status.Conditions, t)
t.Logf(" logs:\n")
for _, container := range pod.Spec.Containers {
var allContainers []v1.Container
allContainers = append(allContainers, pod.Spec.InitContainers...)
allContainers = append(allContainers, pod.Spec.Containers...)
for _, container := range allContainers {
pad := " "
t.Logf("%s%s\n", pad, container.Name)
err := dumpLogs(c, fmt.Sprintf("%s> ", pad), ns, pod.Name, container.Name, t)
Expand Down

0 comments on commit 6689759

Please sign in to comment.