Skip to content

Commit

Permalink
add test for tagFromLastMinor
Browse files Browse the repository at this point in the history
  • Loading branch information
spowelljr committed Oct 6, 2023
1 parent 75bc3f2 commit 6982d3a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/minikube/bootstrapper/images/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,28 @@ func TestCNI(t *testing.T) {
})
}
}

func TestTagFromLastMinor(t *testing.T) {
tests := []struct {
verString string
imageName string
expectedTag string
}{
{"1.16.50", "coredns", "1.6.2"},
{"1.16.50", "etcd", "3.3.15-0"},
{"1.16.50", "pause", "3.1"},
{"1.16.50", "fake", "default"},
}

for _, tc := range tests {
v, err := semver.Parse(tc.verString)
if err != nil {
t.Errorf("failed to parse version to semver: %v", err)
continue
}
got := tagFromLastMinor(v, tc.imageName, "default")
if tc.expectedTag != got {
t.Errorf("tagFromLastMinor(%s, %s, default) = %s; want = %s", tc.verString, tc.imageName, got, tc.expectedTag)
}
}
}

0 comments on commit 6982d3a

Please sign in to comment.