TestList_AllNamespaces with namespace cases

Updated the TestList_AllNamespaces to have different namespaces in the releases it tests with.

Signed-off-by: Aleksandar Faraj <AleksandarFaraj@users.noreply.github.com>
pull/11658/head
Aleksandar Faraj 3 years ago committed by GitHub
parent 3636f68247
commit 01f271a917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,7 +79,7 @@ func TestList_OneNamespace(t *testing.T) {
func TestList_AllNamespaces(t *testing.T) { func TestList_AllNamespaces(t *testing.T) {
is := assert.New(t) is := assert.New(t)
lister := newListFixture(t) lister := newListFixture(t)
makeMeSomeReleases(lister.cfg.Releases, t) makeMeSomeReleasesWithDifferentNamespaces(lister.cfg.Releases, t)
lister.AllNamespaces = true lister.AllNamespaces = true
lister.SetStateMask() lister.SetStateMask()
list, err := lister.Run() list, err := lister.Run()
@ -286,6 +286,34 @@ func makeMeSomeReleases(store *storage.Storage, t *testing.T) {
assert.Len(t, all, 3, "sanity test: three items added") assert.Len(t, all, 3, "sanity test: three items added")
} }
func makeMeSomeReleasesWithDifferentNamespaces(store *storage.Storage, t *testing.T) {
t.Helper()
one := releaseStub()
one.Name = "one"
one.Namespace = "default1"
one.Version = 1
two := releaseStub()
two.Name = "two"
two.Namespace = "default2"
two.Version = 2
three := releaseStub()
three.Name = "three"
three.Namespace = "default3"
three.Version = 3
for _, rel := range []*release.Release{one, two, three} {
if err := store.Create(rel); err != nil {
t.Fatal(err)
}
}
all, err := store.ListReleases()
assert.NoError(t, err)
assert.Len(t, all, 3, "sanity test: three items added")
}
func TestFilterLatestReleases(t *testing.T) { func TestFilterLatestReleases(t *testing.T) {
t.Run("should filter old versions of the same release", func(t *testing.T) { t.Run("should filter old versions of the same release", func(t *testing.T) {
r1 := releaseStub() r1 := releaseStub()

Loading…
Cancel
Save