diff --git a/internal/distroregistry/distroregistry_test.go b/internal/distroregistry/distroregistry_test.go index c38985f26..ebe6a8665 100644 --- a/internal/distroregistry/distroregistry_test.go +++ b/internal/distroregistry/distroregistry_test.go @@ -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")) + }) +}