-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatting of images for a private registry, closes #13
- Loading branch information
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package docker | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/docker/engine-api/types" | ||
) | ||
|
||
func TestImageNameFormatting(t *testing.T) { | ||
formatter := ImageFormatter{ | ||
trunc: false, | ||
image: types.Image{ | ||
RepoTags: []string{"nginx:1.10.0-alpine"}, | ||
}, | ||
} | ||
|
||
repo := formatter.Repository() | ||
tag := formatter.Tag() | ||
if repo != "nginx" { | ||
t.Errorf("Repo value not what expected after formatting: %s", repo) | ||
} else if tag != "1.10.0-alpine" { | ||
t.Errorf("Tag value not what expected after formatting: %s", tag) | ||
} | ||
} | ||
func TestImageNameFormattingPrivateRegistry(t *testing.T) { | ||
formatter := ImageFormatter{ | ||
trunc: false, | ||
image: types.Image{ | ||
RepoTags: []string{"localhost:5000/nginx:1.10.0-alpine"}, | ||
}, | ||
} | ||
|
||
repo := formatter.Repository() | ||
tag := formatter.Tag() | ||
if repo != "localhost:5000/nginx" { | ||
t.Errorf("Repo value not what expected after formatting: %s", repo) | ||
} else if tag != "1.10.0-alpine" { | ||
t.Errorf("Tag value not what expected after formatting: %s", tag) | ||
} | ||
} |