Skip to content

Commit

Permalink
Merge pull request kubevirt#6329 from zhlhahaha/2264
Browse files Browse the repository at this point in the history
add initial tests cases for arm64
  • Loading branch information
kubevirt-bot authored Sep 30, 2021
2 parents f7887bd + 6a5bee5 commit 42a49ae
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (r rights) list() (e []rightsEntry) {
return
}

var _ = Describe("[rfe_id:500][crit:high][vendor:[email protected]][level:component][sig-compute]User Access", func() {
var _ = Describe("[rfe_id:500][crit:high][arm64][vendor:[email protected]][level:component][sig-compute]User Access", func() {

var k8sClient string
var authClient *authClientV1.AuthorizationV1Client
Expand Down
2 changes: 1 addition & 1 deletion tests/container_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ var _ = Describe("[rfe_id:588][crit:medium][vendor:[email protected]][level:comp
})
})

Describe("[rfe_id:4052][crit:high][vendor:[email protected]][level:component]VMI disk permissions", func() {
Describe("[rfe_id:4052][crit:high][arm64][vendor:[email protected]][level:component]VMI disk permissions", func() {
Context("with ephemeral registry disk", func() {
It("[test_id:4299]should not have world write permissions", func() {
vmi := tests.NewRandomVMIWithEphemeralDisk(cd.ContainerDiskFor(cd.ContainerDiskAlpine))
Expand Down
2 changes: 1 addition & 1 deletion tests/network/vmi_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (
"kubevirt.io/kubevirt/tests/libnet"
)

var _ = SIGDescribe("[crit:high][vendor:[email protected]][level:component]", func() {
var _ = SIGDescribe("[crit:high][arm64][vendor:[email protected]][level:component]", func() {
var err error
var virtClient kubecli.KubevirtClient
var vmi *v1.VirtualMachineInstance
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ var _ = SIGDescribe("Storage", func() {
})
})

Context("[rfe_id:2288][crit:high][vendor:[email protected]][level:component] With not existing PVC", func() {
Context("[rfe_id:2288][crit:high][arm64][vendor:[email protected]][level:component] With not existing PVC", func() {
// Not a candidate for NFS because the PVC in question doesn't actually exist
It("[test_id:1040] should get unschedulable condition", func() {
// Start the VirtualMachineInstance
Expand Down
28 changes: 27 additions & 1 deletion tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ import (
var Config *KubeVirtTestsConfiguration
var KubeVirtDefaultConfig v1.KubeVirtConfiguration
var CDIInsecureRegistryConfig *k8sv1.ConfigMap
var Arch string

type EventType string

Expand Down Expand Up @@ -678,6 +679,7 @@ func BeforeTestSuitSetup(_ []byte) {
log.Log.SetIOWriter(GinkgoWriter)
var err error
Config, err = loadConfig()
Arch = getArch()
Expect(err).ToNot(HaveOccurred())

// Customize host disk paths
Expand Down Expand Up @@ -2123,7 +2125,13 @@ func NewRandomVMIWithNS(namespace string) *v1.VirtualMachineInstance {
Masquerade: &v1.InterfaceMasquerade{}}}}}

vmi.Spec.Networks = []v1.Network{*v1.DefaultPodNetwork()}
vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("128Mi")
if isARM64() {
// Cirros image need 256M to boot on ARM64,
// this issue is traced in https://github.com/kubevirt/kubevirt/issues/6363
vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("256Mi")
} else {
vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("128Mi")
}

return vmi
}
Expand Down Expand Up @@ -4325,6 +4333,24 @@ func HasCDI() bool {
return HasDataVolumeCRD()
}

func getArch() string {
virtCli, err := kubecli.GetKubevirtClient()
util2.PanicOnError(err)
nodes := util2.GetAllSchedulableNodes(virtCli).Items
Expect(nodes).ToNot(BeEmpty(), "There should be some node")
return nodes[0].Status.NodeInfo.Architecture
}

func isARM64() bool {
return Arch == "arm64"
}

func SkipIfARM64(message string) {
if isARM64() {
Skip("Skip test on arm64: " + message)
}
}

func HasBindingModeWaitForFirstConsumer() bool {
virtClient, err := kubecli.GetKubevirtClient()
Expect(err).ToNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion tests/vm_watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func createCommandWithNSAndRedirect(namespace, cmdName string, args ...string) (
return cmd, stdOut, stdErr, nil
}

var _ = Describe("[rfe_id:3423][crit:high][vendor:[email protected]][level:component][sig-compute]VmWatch", func() {
var _ = Describe("[rfe_id:3423][crit:high][arm64][vendor:[email protected]][level:component][sig-compute]VmWatch", func() {
var err error
var virtCli kubecli.KubevirtClient

Expand Down
6 changes: 5 additions & 1 deletion tests/vmi_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func addNodeAffinityToVMI(vmi *v1.VirtualMachineInstance, nodeName string) {
}
}

var _ = Describe("[rfe_id:273][crit:high][vendor:[email protected]][level:component][sig-compute]VMIlifecycle", func() {
var _ = Describe("[rfe_id:273][crit:high][arm64][vendor:[email protected]][level:component][sig-compute]VMIlifecycle", func() {

var err error
var virtClient kubecli.KubevirtClient
Expand Down Expand Up @@ -829,6 +829,8 @@ var _ = Describe("[rfe_id:273][crit:high][vendor:[email protected]][level:compon

//store old kubevirt-config
BeforeEach(func() {
// arm64 does not support cpu model
tests.SkipIfARM64("arm64 does not support cpu model")
kv := util.GetCurrentKv(virtClient)
originalConfig = kv.Spec.Configuration
})
Expand Down Expand Up @@ -928,6 +930,8 @@ var _ = Describe("[rfe_id:273][crit:high][vendor:[email protected]][level:compon
}

BeforeEach(func() {
// arm64 does not support cpu model
tests.SkipIfARM64("arm64 does not support cpu model")
nodes := util.GetAllSchedulableNodes(virtClient)
Expect(nodes.Items).ToNot(BeEmpty(), "There should be some compute node")

Expand Down

0 comments on commit 42a49ae

Please sign in to comment.