integration: Log the instance output

This adds logging so that you can dig deeper into crashes or issues.
This commit is contained in:
James Shubin
2018-03-09 22:43:07 -05:00
parent 62d1fc7ed3
commit ddefb4e987
2 changed files with 34 additions and 1 deletions

View File

@@ -41,6 +41,9 @@ func TestInstance0(t *testing.T) {
}
if err := m.SimpleDeployLang(code); err != nil {
t.Errorf("failed with: %+v", err)
if output, err := m.CombinedOutput(); err == nil {
t.Errorf("logs from instance:\n\n%s", output)
}
return
}
d := m.Dir()
@@ -98,6 +101,9 @@ func TestInstance1(t *testing.T) {
if !fail && err != nil {
t.Errorf("failed with: %+v", err)
if output, err := m.CombinedOutput(); err == nil {
t.Errorf("logs from instance:\n\n%s", output)
}
return
}
if fail && err == nil {
@@ -207,9 +213,15 @@ func TestCluster1(t *testing.T) {
if d := c.Dir(); d != "" {
t.Logf("test ran in:\n%s", d)
}
instances := c.Instances()
if !fail && err != nil {
t.Errorf("failed with: %+v", err)
for _, h := range hosts {
if output, err := instances[h].CombinedOutput(); err == nil {
t.Errorf("logs from instance `%s`:\n\n%s", h, output)
}
}
return
}
if fail && err == nil {
@@ -221,7 +233,6 @@ func TestCluster1(t *testing.T) {
return
}
instances := c.Instances()
for _, h := range hosts {
instance := instances[h]
d := instance.Dir()