44 "io/fs"
55 "testing"
66
7- "github.com/osbuild/images/data/repositories"
7+ repos "github.com/osbuild/images/data/repositories"
88 "github.com/osbuild/images/pkg/customizations/subscription"
99 "github.com/osbuild/images/pkg/disk"
1010 "github.com/osbuild/images/pkg/distrofactory"
@@ -17,6 +17,12 @@ import (
1717 "github.com/stretchr/testify/require"
1818)
1919
20+ // Change these when moving to a new release
21+ const (
22+ TEST_DISTRO_NAME = "fedora-42"
23+ TEST_DISTRO_VERSION = "42"
24+ )
25+
2026// GetTestBlueprint returns a populated blueprint
2127// This is used in testing the Customizations compose request
2228// and the Blueprint compose request.
@@ -805,7 +811,7 @@ func TestGetImageRequests_ImageTypeConversion(t *testing.T) {
805811func TestGetImageRequests_NoRepositories (t * testing.T ) {
806812 uo := UploadOptions (struct {}{})
807813 request := & ComposeRequest {
808- Distribution : "fedora-42" ,
814+ Distribution : TEST_DISTRO_NAME ,
809815 ImageRequest : & ImageRequest {
810816 Architecture : "x86_64" ,
811817 ImageType : ImageTypesAws ,
@@ -819,14 +825,14 @@ func TestGetImageRequests_NoRepositories(t *testing.T) {
819825 assert .NoError (t , err )
820826 require .Len (t , got , 1 )
821827 require .Greater (t , len (got [0 ].repositories ), 0 )
822- assert .Contains (t , got [0 ].repositories [0 ].Metalink , "42" )
828+ assert .Contains (t , got [0 ].repositories [0 ].Metalink , TEST_DISTRO_VERSION )
823829}
824830
825831// TestGetImageRequests_BlueprintDistro test to make sure blueprint distro overrides request distro
826832func TestGetImageRequests_BlueprintDistro (t * testing.T ) {
827833 uo := UploadOptions (struct {}{})
828834 request := & ComposeRequest {
829- Distribution : "fedora-42" ,
835+ Distribution : TEST_DISTRO_NAME ,
830836 ImageRequest : & ImageRequest {
831837 Architecture : "x86_64" ,
832838 ImageType : ImageTypesAws ,
@@ -835,7 +841,7 @@ func TestGetImageRequests_BlueprintDistro(t *testing.T) {
835841 },
836842 Blueprint : & Blueprint {
837843 Name : "distro-test" ,
838- Distro : common .ToPtr ("fedora-42" ),
844+ Distro : common .ToPtr (TEST_DISTRO_NAME ),
839845 },
840846 }
841847 rr , err := reporegistry .New (nil , []fs.FS {repos .FS })
@@ -844,8 +850,8 @@ func TestGetImageRequests_BlueprintDistro(t *testing.T) {
844850 assert .NoError (t , err )
845851 require .Len (t , got , 1 )
846852 require .Greater (t , len (got [0 ].repositories ), 0 )
847- assert .Contains (t , got [0 ].repositories [0 ].Metalink , "42" )
848- assert .Equal (t , got [0 ].blueprint .Distro , "fedora-42" )
853+ assert .Contains (t , got [0 ].repositories [0 ].Metalink , TEST_DISTRO_VERSION )
854+ assert .Equal (t , got [0 ].blueprint .Distro , TEST_DISTRO_NAME )
849855}
850856
851857func TestOpenSCAPTailoringOptions (t * testing.T ) {
0 commit comments