distro: don't use a global variable to store the distro register
Introduce a DistroRegister object. For now this does not introduce any functional changes, as the object is always instantited to be the same. However, in follow-up patches it will get options. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
6c49560479
commit
5fcdd4bea5
11 changed files with 59 additions and 40 deletions
|
|
@ -19,7 +19,8 @@ func TestListOutputFormats(t *testing.T) {
|
|||
"vmdk",
|
||||
}
|
||||
|
||||
f30 := distro.New("fedora-30")
|
||||
distros := distro.NewRegistry()
|
||||
f30 := distros.GetDistro("fedora-30")
|
||||
if got := f30.ListOutputFormats(); !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListOutputFormats() = %v, want %v", got, want)
|
||||
}
|
||||
|
|
@ -92,7 +93,8 @@ func TestFilenameFromType(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
f30 := distro.New("fedora-30")
|
||||
distros := distro.NewRegistry()
|
||||
f30 := distros.GetDistro("fedora-30")
|
||||
got, got1, err := f30.FilenameFromType(tt.args.outputFormat)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("FilenameFromType() error = %v, wantErr %v", err, tt.wantErr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue