Skip to content

Commit

Permalink
Modify integration-test workflow and CreateMachine test
Browse files Browse the repository at this point in the history
  • Loading branch information
kasabe28 committed Jan 1, 2024
1 parent 236e334 commit 257ebbe
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ jobs:
sudo apt-get install -y cpu-checker
sudo kvm-ok
sudo apt-get install -y qemu-kvm libvirt-daemon-system
sudo usermod -aG libvirt $USER
sudo setfacl -m user:$USER:rw /var/run/libvirt/libvirt-sock
sudo systemctl enable --now libvirtd
sudo systemctl start libvirtd
sudo systemctl status libvirtd
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
sudo setfacl -m user:$USER:rw /var/run/libvirt/libvirt-sock
sudo update-ca-certificates
sudo rm -rf /var/lib/apt/lists
sudo setfacl -m u:libvirt-qemu:rx /home/$USER/
- name: Run go tests
run: |
Expand Down
2 changes: 2 additions & 0 deletions pkg/controllers/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ func (r *MachineReconciler) domainFor(
return nil, nil, nil, err
}

domainSettings.Type = "kvm"

domainDesc := &libvirtxml.Domain{
Name: machine.GetID(),
UUID: machine.GetID(),
Expand Down
18 changes: 5 additions & 13 deletions provider/server/machine_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var _ = Describe("Create Machine", func() {
Spec: &iri.MachineSpec{
Power: iri.Power_POWER_ON,
Image: &iri.ImageSpec{
Image: "example.org/foo:latest",
Image: "alpine:3.14",
},
Class: machineClassx3xlarge,
IgnitionData: ignitionData,
Expand Down Expand Up @@ -68,19 +68,11 @@ var _ = Describe("Create Machine", func() {
Expect(resp.Machines).NotTo(BeEmpty())
return resp.Machines[0].Status
}).Should(SatisfyAll(
HaveField("ObservedGeneration", BeZero()),
HaveField("ImageRef", BeEmpty()),
HaveField("Volumes", BeNil()),
HaveField("NetworkInterfaces", BeNil()),
HaveField("State", Equal(iri.MachineState_MACHINE_RUNNING)),
// HaveField("Access", SatisfyAll(
// HaveField("Driver", "ceph"),
// HaveField("Handle", image.Spec.WWN),
// HaveField("Attributes", SatisfyAll(
// HaveKeyWithValue("monitors", image.Status.Access.Monitors),
// HaveKeyWithValue("image", image.Status.Access.Handle),
// )),
// HaveField("SecretData", SatisfyAll(
// HaveKeyWithValue("userID", []byte(image.Status.Access.User)),
// HaveKeyWithValue("userKey", []byte(image.Status.Access.UserKey)),
// )),
// )),
))
})
})
6 changes: 3 additions & 3 deletions provider/server/machine_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ var _ = Describe("ListMachine", func() {
},
Spec: &iri.MachineSpec{
Power: iri.Power_POWER_ON,
Image: &iri.ImageSpec{
Image: "example.org/foo:latest",
},
// Image: &iri.ImageSpec{
// Image: "example.org/foo:latest",
// },
Class: machineClassx3xlarge,
},
},
Expand Down
12 changes: 6 additions & 6 deletions provider/server/server_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
)

const (
eventuallyTimeout = 3 * time.Second
eventuallyTimeout = 50 * time.Second
pollingInterval = 50 * time.Millisecond
consistentlyDuration = 1 * time.Second
baseURL = "http://localhost:8080"
Expand Down Expand Up @@ -89,11 +89,11 @@ var _ = BeforeSuite(func() {
RootDir: fmt.Sprintf("%s/libvirt-provider", userHomeDir),
StreamingAddress: streamingAddress,
Libvirt: app.LibvirtOptions{
Socket: "/var/run/libvirt/libvirt-sock",
URI: "qemu:///system",
// PreferredDomainTypes: []string{"kvm", "qemu"},
// PreferredMachineTypes: []string{"pc-i440fx-2.9", "pc-i440fx-2.8"},
Qcow2Type: "exec",
Socket: "/var/run/libvirt/libvirt-sock",
URI: "qemu:///system",
PreferredDomainTypes: []string{"kvm", "qemu"},
PreferredMachineTypes: []string{"pc-q35", "pc-i440fx-2.9", "pc-i440fx-2.8"},
Qcow2Type: "exec",
},
NicPlugin: apinetPlugin,
// TODO: add other required fields
Expand Down

0 comments on commit 257ebbe

Please sign in to comment.