From d6831a1fa6beb748253c0c180346f42ae2b6e18a Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Fri, 12 Jan 2018 11:52:35 +0000 Subject: [PATCH 1/3] Fix timeout issue of multi-services cration on AArch64 Now we only adjust the timeout value for `arm` while not `arm64`, actually the avarage duration for this test is about 25s to crate multiple services on arm64, else the integration test will terminate with below error: > --- FAIL: TestCreateServiceMultipleTimes (24.11s) > daemon.go:285: [ddc3c7c1476c2] waiting for daemon to start > daemon.go:317: [ddc3c7c1476c2] daemon started > poll.go:121: timeout hit after 10s: task count at 4 waiting for 0 > daemon.go:275: [ddc3c7c1476c2] exiting daemon > clean.go:108: Removing image sha256:e6a8d12d58602a19277ee5632b7ff9fa56a4ea52ba00eedf1d3f6f5a495fe761 > clean.go:108: Removing image sha256:876244cc2ecb8fe1b0b2e817e3b78709a2a735edb093bc6849f99aa6c18f3a01 This PR adjusts the timeout value for both `arm64` and `arm` to mitigate this issue on those 2 platforms. Signed-off-by: Dennis Chen Upstream-commit: 4542016cbe985d2af60c25f6a5b24df50bb50aba Component: engine --- components/engine/integration/service/create_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/engine/integration/service/create_test.go b/components/engine/integration/service/create_test.go index a4373721f5..7e78b94992 100644 --- a/components/engine/integration/service/create_test.go +++ b/components/engine/integration/service/create_test.go @@ -43,7 +43,8 @@ func TestCreateServiceMultipleTimes(t *testing.T) { require.NoError(t, err) pollSettings := func(config *poll.Settings) { - if runtime.GOARCH == "arm" { + // It takes about ~25s to finish the multi services creation in this case per the pratical observation on arm64/arm platform + if runtime.GOARCH == "arm64" || runtime.GOARCH == "arm" { config.Timeout = 30 * time.Second config.Delay = 100 * time.Millisecond } From 4f33349d30f86fabc6e61884b04f7b27674cf584 Mon Sep 17 00:00:00 2001 From: Emil Davtyan Date: Fri, 12 Jan 2018 16:43:09 +0100 Subject: [PATCH 2/3] Wrap response error for container logs method. Signed-off-by: Emil Davtyan Upstream-commit: 2d6fb87ca41c52b255e874be62f2a3c2181a7639 Component: engine --- components/engine/client/container_logs.go | 2 +- components/engine/client/container_logs_test.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/engine/client/container_logs.go b/components/engine/client/container_logs.go index 35c297c5fb..562c8b4bcc 100644 --- a/components/engine/client/container_logs.go +++ b/components/engine/client/container_logs.go @@ -74,7 +74,7 @@ func (cli *Client) ContainerLogs(ctx context.Context, container string, options resp, err := cli.get(ctx, "/containers/"+container+"/logs", query, nil) if err != nil { - return nil, err + return nil, wrapResponseError(err, resp, "container", container) } return resp.body, nil } diff --git a/components/engine/client/container_logs_test.go b/components/engine/client/container_logs_test.go index 8cb7635120..41849cf576 100644 --- a/components/engine/client/container_logs_test.go +++ b/components/engine/client/container_logs_test.go @@ -18,6 +18,16 @@ import ( "golang.org/x/net/context" ) +func TestContainerLogsNotFoundError(t *testing.T) { + client := &Client{ + client: newMockClient(errorMock(http.StatusNotFound, "Not found")), + } + _, err := client.ContainerLogs(context.Background(), "container_id", types.ContainerLogsOptions{}) + if !IsErrNotFound(err) { + t.Fatalf("expected a not found error, got %v", err) + } +} + func TestContainerLogsError(t *testing.T) { client := &Client{ client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), From 837919cf56f59129dd022a8c42c740cf2b950dbc Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 12 Jan 2018 11:05:20 -0500 Subject: [PATCH 3/3] [ci] use alternate bash comparison The pattern `echo str | grep -qE pattern` likes to fail on the z CI here for an unknown reason. Use `grep -qE pattern <<< str` instead. Signed-off-by: Christopher Jones Upstream-commit: 24da8a0ed415c019179ca2c4f7496cbdffb7e4d0 Component: engine --- components/engine/contrib/download-frozen-image-v2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/contrib/download-frozen-image-v2.sh b/components/engine/contrib/download-frozen-image-v2.sh index 22a4b78273..54b592307f 100755 --- a/components/engine/contrib/download-frozen-image-v2.sh +++ b/components/engine/contrib/download-frozen-image-v2.sh @@ -63,7 +63,7 @@ fetch_blob() { -D- )" curlHeaders="$(echo "$curlHeaders" | tr -d '\r')" - if echo "$curlHeaders" | grep -qE "^HTTP/[0-9].[0-9] 3"; then + if grep -qE "^HTTP/[0-9].[0-9] 3" <<<"$curlHeaders"; then rm -f "$targetFile" local blobRedirect="$(echo "$curlHeaders" | awk -F ': ' 'tolower($1) == "location" { print $2; exit }')"