Skip to content

Commit

Permalink
Test for getMachineTypeForArch()
Browse files Browse the repository at this point in the history
Signed-off-by: Egbert Eich <eich@suse.com>
  • Loading branch information
e4t committed Apr 24, 2023
1 parent ceda731 commit a17855f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions libvirt/utils_domain_def_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,29 @@ func TestGetOriginalMachineName(t *testing.T) {
t.Logf("Reverse canonical lookup for %s is %s which matches %s", canonname, reversename, machine)
}

func TestGetMachineTypeForArch(t *testing.T) {
skipIfAccDisabled(t)
conn := testAccProvider.Meta().(*Client).libvirt
caps, err := getHostCapabilities(conn)
if err != nil {
t.Error(err)
}

arch := "x86_64"
targettype := "hvm"
machine := "pc"

m, err := getMachineTypeForArch(caps, arch, targettype)
if err != nil {
t.Error(err)
}
if m != machine {
t.Errorf("Machine found for arch %s, targettype %s is %s expected %s", arch, targettype, m, machine)
}

t.Logf("Machine for arch %s, targettype %s is %s which matches %s", arch, targettype, m, machine)
}

func TestGetHostCapabilties(t *testing.T) {
skipIfAccDisabled(t)
conn := testAccProvider.Meta().(*Client).libvirt
Expand Down

0 comments on commit a17855f

Please sign in to comment.