From b40c4cbf2f77cb41a557d51fcf7fb0ac2f216338 Mon Sep 17 00:00:00 2001 From: fenxiong Date: Thu, 2 May 2019 07:57:09 -0700 Subject: [PATCH] Fix TestShutdownOrder and turn on debug log for integ test. TestShutdownOrder sometimes ended up hanging because we didn't wait for task stopped state change which in turns can block task engine shut down. Fixing by waiting for the task state change. --- Makefile | 4 ++-- agent/engine/ordering_integ_test.go | 1 + scripts/run-integ-tests.ps1 | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index feb2b07faf9..6630db7be88 100644 --- a/Makefile +++ b/Makefile @@ -276,10 +276,10 @@ cni-plugins: get-cni-sources .out-stamp build-ecs-cni-plugins build-vpc-cni-plug ifeq (${BUILD_PLATFORM},aarch64) run-integ-tests: test-registry gremlin container-health-check-image run-sudo-tests - . ./scripts/shared_env && go test -tags integration -timeout=25m -v ./agent/engine/... ./agent/stats/... ./agent/app/... + . ./scripts/shared_env && ECS_LOGLEVEL=debug go test -tags integration -timeout=25m -v ./agent/engine/... ./agent/stats/... ./agent/app/... else run-integ-tests: test-registry gremlin container-health-check-image run-sudo-tests - . ./scripts/shared_env && go test -race -tags integration -timeout=25m -v ./agent/engine/... ./agent/stats/... ./agent/app/... + . ./scripts/shared_env && ECS_LOGLEVEL=debug go test -race -tags integration -timeout=25m -v ./agent/engine/... ./agent/stats/... ./agent/app/... endif ifeq (${BUILD_PLATFORM},aarch64) diff --git a/agent/engine/ordering_integ_test.go b/agent/engine/ordering_integ_test.go index f7c2906298a..4a3e8051504 100644 --- a/agent/engine/ordering_integ_test.go +++ b/agent/engine/ordering_integ_test.go @@ -426,6 +426,7 @@ func TestShutdownOrder(t *testing.T) { assert.Equal(t, expectedA.(api.ContainerStateChange).Status, status.ContainerStopped) assert.Equal(t, expectedA.(api.ContainerStateChange).ContainerName, "C") + verifyTaskIsStopped(stateChangeEvents, testTask) close(finished) }() diff --git a/scripts/run-integ-tests.ps1 b/scripts/run-integ-tests.ps1 index 69e893c084d..97f2048bc8e 100755 --- a/scripts/run-integ-tests.ps1 +++ b/scripts/run-integ-tests.ps1 @@ -33,7 +33,7 @@ Invoke-Expression "${PSScriptRoot}\..\misc\netkitten\build.ps1" $cwd = (pwd).Path try { cd "${PSScriptRoot}" - go test -race -tags integration -timeout=40m -v ../agent/engine ../agent/stats ../agent/app + $env:ECS_LOGLEVEL = 'debug'; go test -race -tags integration -timeout=40m -v ../agent/engine ../agent/stats ../agent/app $testsExitCode = $LastExitCode } finally { cd "$cwd"