| ... | ... |
@@ -611,11 +611,11 @@ type JSONMessage struct {
|
| 611 | 611 |
Status string `json:"status,omitempty"` |
| 612 | 612 |
Progress string `json:"progress,omitempty"` |
| 613 | 613 |
Error string `json:"error,omitempty"` |
| 614 |
- ID string `json:"id,omitempty"` |
|
| 615 |
- Time int64 `json:"time,omitempty"` |
|
| 614 |
+ ID string `json:"id,omitempty"` |
|
| 615 |
+ Time int64 `json:"time,omitempty"` |
|
| 616 | 616 |
} |
| 617 | 617 |
|
| 618 |
-func (jm *JSONMessage) Display(out io.Writer) (error) {
|
|
| 618 |
+func (jm *JSONMessage) Display(out io.Writer) error {
|
|
| 619 | 619 |
if jm.Time != 0 {
|
| 620 | 620 |
fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0)) |
| 621 | 621 |
} |
| ... | ... |
@@ -631,7 +631,6 @@ func (jm *JSONMessage) Display(out io.Writer) (error) {
|
| 631 | 631 |
return nil |
| 632 | 632 |
} |
| 633 | 633 |
|
| 634 |
- |
|
| 635 | 634 |
type StreamFormatter struct {
|
| 636 | 635 |
json bool |
| 637 | 636 |
used bool |
| ... | ... |
@@ -282,3 +282,24 @@ func TestParseHost(t *testing.T) {
|
| 282 | 282 |
t.Errorf("unix:///var/run/docker.sock -> expected unix:///var/run/docker.sock, got %s", addr)
|
| 283 | 283 |
} |
| 284 | 284 |
} |
| 285 |
+ |
|
| 286 |
+func TestParseRepositoryTag(t *testing.T) {
|
|
| 287 |
+ if repo, tag := ParseRepositoryTag("root"); repo != "root" || tag != "" {
|
|
| 288 |
+ t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "root", "", repo, tag)
|
|
| 289 |
+ } |
|
| 290 |
+ if repo, tag := ParseRepositoryTag("root:tag"); repo != "root" || tag != "tag" {
|
|
| 291 |
+ t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "root", "tag", repo, tag)
|
|
| 292 |
+ } |
|
| 293 |
+ if repo, tag := ParseRepositoryTag("user/repo"); repo != "user/repo" || tag != "" {
|
|
| 294 |
+ t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "user/repo", "", repo, tag)
|
|
| 295 |
+ } |
|
| 296 |
+ if repo, tag := ParseRepositoryTag("user/repo:tag"); repo != "user/repo" || tag != "tag" {
|
|
| 297 |
+ t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "user/repo", "tag", repo, tag)
|
|
| 298 |
+ } |
|
| 299 |
+ if repo, tag := ParseRepositoryTag("url:5000/repo"); repo != "url:5000/repo" || tag != "" {
|
|
| 300 |
+ t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "url:5000/repo", "", repo, tag)
|
|
| 301 |
+ } |
|
| 302 |
+ if repo, tag := ParseRepositoryTag("url:5000/repo:tag"); repo != "url:5000/repo" || tag != "tag" {
|
|
| 303 |
+ t.Errorf("Expected repo: '%s' and tag: '%s', got '%s' and '%s'", "url:5000/repo", "tag", repo, tag)
|
|
| 304 |
+ } |
|
| 305 |
+} |