Skip to content

Commit

Permalink
Review 1 - Add unit tests for transform
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Jun 14, 2016
1 parent c11cfbd commit 326a588
Show file tree
Hide file tree
Showing 3 changed files with 482 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pkg/cmd/admin/migrate/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func (o *MigrateImageReferenceOptions) transform(obj runtime.Object) (migrate.Re
return reporter(changed), nil
case *imageapi.ImageStream:
var info imageChangeInfo
if len(t.Spec.DockerImageRepository) > 0 {
info.spec = updateString(&t.Spec.DockerImageRepository, fn)
}
for _, ref := range t.Spec.Tags {
if ref.From == nil || ref.From.Kind != "DockerImage" {
continue
Expand Down Expand Up @@ -387,7 +390,7 @@ func ParseMapping(s string) (ImageReferenceMapping, error) {
if to[0] == "" && to[1] == "" {
return ImageReferenceMapping{}, fmt.Errorf("%q is not a valid target: at least one change must be specified", parts[1])
}
if from[0] == from[1] && to[0] == to[1] {
if from[0] == to[0] && from[1] == to[1] {
return ImageReferenceMapping{}, fmt.Errorf("%q is not valid: must target at least one field to change", s)
}
return ImageReferenceMapping{
Expand Down
Loading

0 comments on commit 326a588

Please sign in to comment.