Skip to content

Commit

Permalink
Print the output of failed integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: David Gageot <[email protected]>
  • Loading branch information
dgageot committed Aug 28, 2019
1 parent dc6d62e commit 238b86b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
4 changes: 1 addition & 3 deletions integration/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,5 @@ func TestDeployWithInCorrectConfigWithNoStatusCheck(t *testing.T) {
ns, _, deleteNs := SetupNamespace(t)
defer deleteNs()

skaffold.Deploy().InDir("testdata/unstable-deployment").InNs(ns.Name).RunOrFailOutput(t)

skaffold.Delete().InDir("testdata/unstable-deployment").InNs(ns.Name).RunOrFail(t)
skaffold.Deploy().InDir("testdata/unstable-deployment").InNs(ns.Name).RunOrFail(t)
}
2 changes: 1 addition & 1 deletion integration/dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func TestDev_WithKubecontextOverride(t *testing.T) {
env := []string{fmt.Sprintf("KUBECONFIG=%s", kubeconfig)}

// n.b. for the sake of this test the namespace must not be given explicitly
skaffold.Run("--kube-context", kubecontext).InDir(dir).WithEnv(env).RunOrFailOutput(t.T)
skaffold.Run("--kube-context", kubecontext).InDir(dir).WithEnv(env).RunOrFail(t.T)

client.WaitForPodsReady(pods...)

Expand Down
2 changes: 1 addition & 1 deletion integration/diagnose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestDiagnose(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
skaffold.Diagnose(test.args...).InDir(test.dir).RunOrFailOutput(t)
skaffold.Diagnose(test.args...).InDir(test.dir).RunOrFail(t)
})
}
}
2 changes: 1 addition & 1 deletion integration/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestHelmDeploy(t *testing.T) {

runArgs := []string{"--images", "gcr.io/k8s-skaffold/skaffold-helm"}

skaffold.Deploy(runArgs...).InDir(helmDir).InNs(ns.Name).WithEnv(env).RunOrFailOutput(t)
skaffold.Deploy(runArgs...).InDir(helmDir).InNs(ns.Name).WithEnv(env).RunOrFail(t)

client.WaitForDeploymentsToStabilize(depName)

Expand Down
2 changes: 1 addition & 1 deletion integration/port_forward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestPortForward(t *testing.T) {
defer deleteNs()

dir := "examples/microservices"
skaffold.Run().InDir(dir).InNs(ns.Name).RunOrFailOutput(t)
skaffold.Run().InDir(dir).InNs(ns.Name).RunOrFail(t)

cfg, err := kubectx.CurrentConfig()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion integration/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestRun(t *testing.T) {
ns, client, deleteNs := SetupNamespace(t)
defer deleteNs()

skaffold.Run(test.args...).WithConfig(test.filename).InDir(test.dir).InNs(ns.Name).WithEnv(test.env).RunOrFailOutput(t)
skaffold.Run(test.args...).WithConfig(test.filename).InDir(test.dir).InNs(ns.Name).WithEnv(test.env).RunOrFail(t)

client.WaitForPodsReady(test.pods...)
client.WaitForDeploymentsToStabilize(test.deployments...)
Expand Down
5 changes: 1 addition & 4 deletions integration/skaffold/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ func (b *RunBuilder) RunBackground(t *testing.T) context.CancelFunc {
// RunOrFail runs the skaffold command and fails the test
// if the command returns an error.
func (b *RunBuilder) RunOrFail(t *testing.T) {
t.Helper()
if err := b.Run(t); err != nil {
t.Fatal(err)
}
b.RunOrFailOutput(t)
}

// Run runs the skaffold command.
Expand Down

0 comments on commit 238b86b

Please sign in to comment.