[hyper-provider] update hypercli in vendor

This commit is contained in:
Jimmy Xu
2017-12-22 00:30:03 +08:00
parent 1b3d6eae82
commit a6a6267863
200 changed files with 451 additions and 675 deletions

View File

@@ -12,9 +12,9 @@ import (
"reflect"
"testing"
"github.com/hyperhq/hypercli/pkg/plugins"
"github.com/docker/go-connections/tlsconfig"
"github.com/gorilla/mux"
"github.com/hyperhq/hypercli/pkg/plugins"
)
const pluginAddress = "authzplugin.sock"

View File

@@ -7,13 +7,13 @@ import (
"time"
log "github.com/Sirupsen/logrus"
"github.com/hyperhq/hypercli/pkg/discovery"
"github.com/docker/go-connections/tlsconfig"
"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/docker/libkv/store/consul"
"github.com/docker/libkv/store/etcd"
"github.com/docker/libkv/store/zookeeper"
"github.com/hyperhq/hypercli/pkg/discovery"
)
const (

View File

@@ -8,9 +8,9 @@ import (
"testing"
"time"
"github.com/hyperhq/hypercli/pkg/discovery"
"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/hyperhq/hypercli/pkg/discovery"
"github.com/go-check/check"
)

View File

@@ -3,8 +3,8 @@ package memory
import (
"testing"
"github.com/hyperhq/hypercli/pkg/discovery"
"github.com/go-check/check"
"github.com/hyperhq/hypercli/pkg/discovery"
)
// Hook up gocheck into the "go test" runner.

View File

@@ -7,17 +7,17 @@ import (
func TestJSONLogMarshalJSON(t *testing.T) {
logs := map[JSONLog]string{
JSONLog{Log: `"A log line with \\"`}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":\".{20,}\"}$`,
JSONLog{Log: "A log line"}: `^{\"log\":\"A log line\",\"time\":\".{20,}\"}$`,
JSONLog{Log: "A log line with \r"}: `^{\"log\":\"A log line with \\r\",\"time\":\".{20,}\"}$`,
JSONLog{Log: "A log line with & < >"}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":\".{20,}\"}$`,
JSONLog{Log: "A log line with utf8 : 🚀 ψ ω β"}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":\".{20,}\"}$`,
JSONLog{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":\".{20,}\"}$`,
JSONLog{}: `^{\"time\":\".{20,}\"}$`,
{Log: `"A log line with \\"`}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":\".{20,}\"}$`,
{Log: "A log line"}: `^{\"log\":\"A log line\",\"time\":\".{20,}\"}$`,
{Log: "A log line with \r"}: `^{\"log\":\"A log line with \\r\",\"time\":\".{20,}\"}$`,
{Log: "A log line with & < >"}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":\".{20,}\"}$`,
{Log: "A log line with utf8 : 🚀 ψ ω β"}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":\".{20,}\"}$`,
{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":\".{20,}\"}$`,
{}: `^{\"time\":\".{20,}\"}$`,
// These ones are a little weird
JSONLog{Log: "\u2028 \u2029"}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":\".{20,}\"}$`,
JSONLog{Log: string([]byte{0xaF})}: `^{\"log\":\"\\ufffd\",\"time\":\".{20,}\"}$`,
JSONLog{Log: string([]byte{0x7F})}: `^{\"log\":\"\x7f\",\"time\":\".{20,}\"}$`,
{Log: "\u2028 \u2029"}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":\".{20,}\"}$`,
{Log: string([]byte{0xaF})}: `^{\"log\":\"\\ufffd\",\"time\":\".{20,}\"}$`,
{Log: string([]byte{0x7F})}: `^{\"log\":\"\x7f\",\"time\":\".{20,}\"}$`,
}
for jsonLog, expression := range logs {
data, err := jsonLog.MarshalJSON()

View File

@@ -8,21 +8,21 @@ import (
func TestJSONLogsMarshalJSONBuf(t *testing.T) {
logs := map[*JSONLogs]string{
&JSONLogs{Log: []byte(`"A log line with \\"`)}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line with \r")}: `^{\"log\":\"A log line with \\r\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line with & < >")}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":}$`,
&JSONLogs{Log: []byte("A log line with utf8 : 🚀 ψ ω β")}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":}$`,
&JSONLogs{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":}$`,
&JSONLogs{Stream: "stdout", Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"stream\":\"stdout\",\"time\":}$`,
&JSONLogs{Created: "time"}: `^{\"time\":time}$`,
&JSONLogs{}: `^{\"time\":}$`,
{Log: []byte(`"A log line with \\"`)}: `^{\"log\":\"\\\"A log line with \\\\\\\\\\\"\",\"time\":}$`,
{Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"time\":}$`,
{Log: []byte("A log line with \r")}: `^{\"log\":\"A log line with \\r\",\"time\":}$`,
{Log: []byte("A log line with & < >")}: `^{\"log\":\"A log line with \\u0026 \\u003c \\u003e\",\"time\":}$`,
{Log: []byte("A log line with utf8 : 🚀 ψ ω β")}: `^{\"log\":\"A log line with utf8 : 🚀 ψ ω β\",\"time\":}$`,
{Stream: "stdout"}: `^{\"stream\":\"stdout\",\"time\":}$`,
{Stream: "stdout", Log: []byte("A log line")}: `^{\"log\":\"A log line\",\"stream\":\"stdout\",\"time\":}$`,
{Created: "time"}: `^{\"time\":time}$`,
{}: `^{\"time\":}$`,
// These ones are a little weird
&JSONLogs{Log: []byte("\u2028 \u2029")}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":}$`,
&JSONLogs{Log: []byte{0xaF}}: `^{\"log\":\"\\ufffd\",\"time\":}$`,
&JSONLogs{Log: []byte{0x7F}}: `^{\"log\":\"\x7f\",\"time\":}$`,
{Log: []byte("\u2028 \u2029")}: `^{\"log\":\"\\u2028 \\u2029\",\"time\":}$`,
{Log: []byte{0xaF}}: `^{\"log\":\"\\ufffd\",\"time\":}$`,
{Log: []byte{0x7F}}: `^{\"log\":\"\x7f\",\"time\":}$`,
// with raw attributes
&JSONLogs{Log: []byte("A log line"), RawAttrs: []byte(`{"hello":"world","value":1234}`)}: `^{\"log\":\"A log line\",\"attrs\":{\"hello\":\"world\",\"value\":1234},\"time\":}$`,
{Log: []byte("A log line"), RawAttrs: []byte(`{"hello":"world","value":1234}`)}: `^{\"log\":\"A log line\",\"attrs\":{\"hello\":\"world\",\"value\":1234},\"time\":}$`,
}
for jsonLog, expression := range logs {
var buf bytes.Buffer

View File

@@ -7,9 +7,9 @@ import (
"strings"
"time"
"github.com/docker/go-units"
"github.com/hyperhq/hypercli/pkg/jsonlog"
"github.com/hyperhq/hypercli/pkg/term"
"github.com/docker/go-units"
)
// JSONError wraps a concrete Code and Message, `Code` is

View File

@@ -56,16 +56,16 @@ func TestJSONMessageDisplay(t *testing.T) {
now := time.Now()
messages := map[JSONMessage][]string{
// Empty
JSONMessage{}: {"\n", "\n"},
{}: {"\n", "\n"},
// Status
JSONMessage{
{
Status: "status",
}: {
"status\n",
"status\n",
},
// General
JSONMessage{
{
Time: now.Unix(),
ID: "ID",
From: "From",
@@ -75,7 +75,7 @@ func TestJSONMessageDisplay(t *testing.T) {
fmt.Sprintf("%v ID: (from From) status\n", time.Unix(now.Unix(), 0).Format(jsonlog.RFC3339NanoFixed)),
},
// General, with nano precision time
JSONMessage{
{
TimeNano: now.UnixNano(),
ID: "ID",
From: "From",
@@ -85,7 +85,7 @@ func TestJSONMessageDisplay(t *testing.T) {
fmt.Sprintf("%v ID: (from From) status\n", time.Unix(0, now.UnixNano()).Format(jsonlog.RFC3339NanoFixed)),
},
// General, with both times Nano is preferred
JSONMessage{
{
Time: now.Unix(),
TimeNano: now.UnixNano(),
ID: "ID",
@@ -96,7 +96,7 @@ func TestJSONMessageDisplay(t *testing.T) {
fmt.Sprintf("%v ID: (from From) status\n", time.Unix(0, now.UnixNano()).Format(jsonlog.RFC3339NanoFixed)),
},
// Stream over status
JSONMessage{
{
Status: "status",
Stream: "stream",
}: {
@@ -104,7 +104,7 @@ func TestJSONMessageDisplay(t *testing.T) {
"stream",
},
// With progress message
JSONMessage{
{
Status: "status",
ProgressMessage: "progressMessage",
}: {
@@ -112,7 +112,7 @@ func TestJSONMessageDisplay(t *testing.T) {
"status progressMessage",
},
// With progress, stream empty
JSONMessage{
{
Status: "status",
Stream: "",
Progress: &JSONProgress{Current: 1},