Merge pull request #6355 from dmcgowan/integration-client-restart-daemon-output

Update restart monitor test to output daemon logs on failure
This commit is contained in:
Maksym Pavlenko 2021-12-09 13:51:01 -08:00 committed by GitHub
commit 95b83fa54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 6 deletions

View File

@ -296,6 +296,7 @@ jobs:
- name: Integration 2
env:
TESTFLAGS_PARALLEL: 1
EXTRA_TESTFLAGS: "-short"
CGO_ENABLED: 1
GOTESTSUM_JUNITFILE: ${{github.workspace}}/test-integration-parallel-junit.xml
run: mingw32-make.exe integration

View File

@ -30,6 +30,9 @@ import (
)
func TestClientTTRPC_New(t *testing.T) {
if testing.Short() {
t.Skip()
}
client, err := ttrpcutil.NewClient(address + ".ttrpc")
assert.NilError(t, err)
@ -38,6 +41,9 @@ func TestClientTTRPC_New(t *testing.T) {
}
func TestClientTTRPC_Reconnect(t *testing.T) {
if testing.Short() {
t.Skip()
}
client, err := ttrpcutil.NewClient(address + ".ttrpc")
assert.NilError(t, err)
@ -63,6 +69,9 @@ func TestClientTTRPC_Reconnect(t *testing.T) {
}
func TestClientTTRPC_Close(t *testing.T) {
if testing.Short() {
t.Skip()
}
client, err := ttrpcutil.NewClient(address + ".ttrpc")
assert.NilError(t, err)

View File

@ -140,7 +140,7 @@ func TestImport(t *testing.T) {
ctx, cancel := testContext(t)
defer cancel()
client, err := New(address)
client, err := newClient(t, address)
if err != nil {
t.Fatal(err)
}

View File

@ -32,6 +32,7 @@ import (
"github.com/containerd/containerd/oci"
"github.com/containerd/containerd/pkg/testutil"
srvconfig "github.com/containerd/containerd/services/server/config"
"github.com/containerd/containerd/sys"
exec "golang.org/x/sys/execabs"
)
@ -97,21 +98,25 @@ func newDaemonWithConfig(t *testing.T, configTOML string) (*Client, *daemon, fun
cleanup := func() {
if err := client.Close(); err != nil {
t.Fatalf("failed to close client: %v", err)
t.Errorf("failed to close client: %v", err)
}
if err := ctrd.Stop(); err != nil {
if err := ctrd.Kill(); err != nil {
t.Fatalf("failed to signal containerd: %v", err)
t.Errorf("failed to signal containerd: %v", err)
}
}
if err := ctrd.Wait(); err != nil {
if _, ok := err.(*exec.ExitError); !ok {
t.Fatalf("failed to wait for: %v", err)
t.Errorf("failed to wait for: %v", err)
}
}
if err := os.RemoveAll(tempDir); err != nil {
t.Fatalf("failed to remove %s: %v", tempDir, err)
if err := sys.ForceRemoveAll(tempDir); err != nil {
t.Errorf("failed to remove %s: %v", tempDir, err)
}
if t.Failed() {
t.Log("Daemon output:\n", buf.String())
}
// cleaning config-specific resources is up to the caller
}
return client, &ctrd, cleanup