distroregistry/test: add test for GetDistro
Adding the sweet coverage. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
9bc35d5e98
commit
d7b0323a2d
1 changed files with 15 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/rhel8"
|
||||
)
|
||||
|
||||
// Test that all distros are registered properly and that Registry.List() works.
|
||||
|
|
@ -19,3 +21,16 @@ func TestRegistry_List(t *testing.T) {
|
|||
|
||||
require.ElementsMatch(t, expected, distros.List(), "unexpected list of distros")
|
||||
}
|
||||
|
||||
func TestRegistry_GetDistro(t *testing.T) {
|
||||
distros := NewDefault()
|
||||
|
||||
t.Run("distro exists", func(t *testing.T) {
|
||||
expectedDistro := rhel8.New()
|
||||
require.Equal(t, expectedDistro.Name(), distros.GetDistro(expectedDistro.Name()).Name())
|
||||
})
|
||||
|
||||
t.Run("distro doesn't exist", func(t *testing.T) {
|
||||
require.Nil(t, distros.GetDistro("toucan-os"))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue