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:
commit
95b83fa54f
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -296,6 +296,7 @@ jobs:
|
|||||||
- name: Integration 2
|
- name: Integration 2
|
||||||
env:
|
env:
|
||||||
TESTFLAGS_PARALLEL: 1
|
TESTFLAGS_PARALLEL: 1
|
||||||
|
EXTRA_TESTFLAGS: "-short"
|
||||||
CGO_ENABLED: 1
|
CGO_ENABLED: 1
|
||||||
GOTESTSUM_JUNITFILE: ${{github.workspace}}/test-integration-parallel-junit.xml
|
GOTESTSUM_JUNITFILE: ${{github.workspace}}/test-integration-parallel-junit.xml
|
||||||
run: mingw32-make.exe integration
|
run: mingw32-make.exe integration
|
||||||
|
@ -30,6 +30,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestClientTTRPC_New(t *testing.T) {
|
func TestClientTTRPC_New(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip()
|
||||||
|
}
|
||||||
client, err := ttrpcutil.NewClient(address + ".ttrpc")
|
client, err := ttrpcutil.NewClient(address + ".ttrpc")
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
@ -38,6 +41,9 @@ func TestClientTTRPC_New(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestClientTTRPC_Reconnect(t *testing.T) {
|
func TestClientTTRPC_Reconnect(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip()
|
||||||
|
}
|
||||||
client, err := ttrpcutil.NewClient(address + ".ttrpc")
|
client, err := ttrpcutil.NewClient(address + ".ttrpc")
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
@ -63,6 +69,9 @@ func TestClientTTRPC_Reconnect(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestClientTTRPC_Close(t *testing.T) {
|
func TestClientTTRPC_Close(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip()
|
||||||
|
}
|
||||||
client, err := ttrpcutil.NewClient(address + ".ttrpc")
|
client, err := ttrpcutil.NewClient(address + ".ttrpc")
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ func TestImport(t *testing.T) {
|
|||||||
ctx, cancel := testContext(t)
|
ctx, cancel := testContext(t)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
client, err := New(address)
|
client, err := newClient(t, address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/pkg/testutil"
|
"github.com/containerd/containerd/pkg/testutil"
|
||||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||||
|
"github.com/containerd/containerd/sys"
|
||||||
exec "golang.org/x/sys/execabs"
|
exec "golang.org/x/sys/execabs"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -97,21 +98,25 @@ func newDaemonWithConfig(t *testing.T, configTOML string) (*Client, *daemon, fun
|
|||||||
|
|
||||||
cleanup := func() {
|
cleanup := func() {
|
||||||
if err := client.Close(); err != nil {
|
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.Stop(); err != nil {
|
||||||
if err := ctrd.Kill(); 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 err := ctrd.Wait(); err != nil {
|
||||||
if _, ok := err.(*exec.ExitError); !ok {
|
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 {
|
if err := sys.ForceRemoveAll(tempDir); err != nil {
|
||||||
t.Fatalf("failed to remove %s: %v", tempDir, err)
|
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
|
// cleaning config-specific resources is up to the caller
|
||||||
}
|
}
|
||||||
return client, &ctrd, cleanup
|
return client, &ctrd, cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user