Commit 8529e1da authored by Dmitry Smirnov's avatar Dmitry Smirnov

New upstream patch to fix TestClientStreamJSONDecodeWithTerminal (Closes: #907713)

parent 2cf08639
test--fix-TestClientStreamJSONDecodeWithTerminal.patch
Origin: upstream, https://github.com/fsouza/go-dockerclient/commit/c700811f6b5b17d713ed405ae635bd4374537989
Forwarded: not-needed
Bug-Upstream: https://github.com/fsouza/go-dockerclient/issues/747
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907713
From c700811f6b5b17d713ed405ae635bd4374537989 Mon Sep 17 00:00:00 2001
From: Francisco Souza <fsouza@users.noreply.github.com>
Date: Sun, 6 Jan 2019 11:31:53 -0500
Subject: [PATCH] Disable TestClientStreamJSONDecodeWithTerminal on non-terminal stdout
Fix #747.
--- a/client_test.go
+++ b/client_test.go
@@ -18,8 +18,10 @@
"strconv"
"strings"
"testing"
"time"
+
+ "golang.org/x/crypto/ssh/terminal"
)
func TestNewAPIClient(t *testing.T) {
t.Parallel()
@@ -697,8 +699,11 @@
return true
}
func TestClientStreamJSONDecodeWithTerminal(t *testing.T) {
+ if !terminal.IsTerminal(int(os.Stdout.Fd())) {
+ t.Skip("requires a terminal")
+ }
t.Parallel()
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(mockPullOutput))
}))
@@ -721,9 +726,9 @@
"\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Pulling fs layer \r\x1b[1B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Downloading [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Verifying Checksum \r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Download complete \r\x1b[2B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Downloading [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Verifying Checksum \r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Download complete \r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Extracting [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Extracting [==================================================>] 1.854kB/1.854kB\r\x1b[3B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [> ] 233kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [=> ] 462.4kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [====================> ] 8.491MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Downloading [=================================================> ] 20.88MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Verifying Checksum \r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Download complete \r\x1b[1B\x1b[3A\x1b[1K\x1b[K\r106572778bf7: Pull complete \r\x1b[3B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Extracting [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Extracting [==================================================>] 621B/621B\r\x1b[2B\x1b[2A\x1b[1K\x1b[K\rbac681833e51: Pull complete \r\x1b[2B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [> ] 229.4kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [=> ] 458.8kB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [==========================> ] 11.24MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Extracting [==================================================>] 21.06MB/21.06MB\r\x1b[1B\x1b[1A\x1b[1K\x1b[K\r7302e23ef08a: Pull complete \r\x1b[1BDigest: sha256:b754472891aa7e33fc0214e3efa988174f2c2289285fcae868b7ec8b6675fc77\n" +
"Status: Downloaded newer image for 192.168.50.4:5000/tsuru/static\n"
result := w.String()
if result != expected {
- t.Fatalf("expected stream result %q, got: %q", expected, result)
+ t.Fatalf("wrong stream result\nwant %v\ngot: %v", expected, result)
}
}
func TestClientDoContextDeadline(t *testing.T) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment