diff --git a/grid-client/integration_tests/batch_k8s_test.go b/grid-client/integration_tests/batch_k8s_test.go index 95165bc55..58245f075 100644 --- a/grid-client/integration_tests/batch_k8s_test.go +++ b/grid-client/integration_tests/batch_k8s_test.go @@ -46,67 +46,32 @@ func TestBatchK8sDeployment(t *testing.T) { require.NoError(t, err) }) - masterSeed1, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - - masterSeed2, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - - workerNodeSeed1, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - - workerNodeSeed2, err := workloads.RandomMyceliumIPSeed() + masterVM1, err := generateBasicVM(generateRandString(10), nodeID1, network.Name, "") require.NoError(t, err) master1 := workloads.K8sNode{ - VM: &workloads.VM{ - Name: generateRandString(10), - NetworkName: network.Name, - NodeID: nodeID1, - Planetary: true, - CPU: minCPU, - MemoryMB: minMemory * 1024, - MyceliumIPSeed: masterSeed1, - }, + VM: &masterVM1, DiskSizeGB: 1, } + masterVM2, err := generateBasicVM(generateRandString(10), nodeID2, network.Name, "") + require.NoError(t, err) master2 := workloads.K8sNode{ - VM: &workloads.VM{ - Name: generateRandString(10), - NetworkName: network.Name, - NodeID: nodeID2, - Planetary: true, - CPU: minCPU, - MemoryMB: minMemory * 1024, - MyceliumIPSeed: masterSeed2, - }, + VM: &masterVM2, DiskSizeGB: 1, } + vm1, err := generateBasicVM(generateRandString(10), nodeID1, network.Name, "") + require.NoError(t, err) workerNodeData1 := workloads.K8sNode{ - VM: &workloads.VM{ - Name: generateRandString(10), - NetworkName: network.Name, - NodeID: nodeID1, - Planetary: true, - CPU: minCPU, - MemoryMB: minMemory * 1024, - MyceliumIPSeed: workerNodeSeed1, - }, + VM: &vm1, DiskSizeGB: 1, } + vm2, err := generateBasicVM(generateRandString(10), nodeID2, network.Name, "") + require.NoError(t, err) workerNodeData2 := workloads.K8sNode{ - VM: &workloads.VM{ - Name: generateRandString(10), - NetworkName: network.Name, - NodeID: nodeID2, - Planetary: true, - CPU: minCPU, - MemoryMB: minMemory * 1024, - MyceliumIPSeed: workerNodeSeed2, - }, + VM: &vm2, DiskSizeGB: 1, } diff --git a/grid-client/integration_tests/k8s_test.go b/grid-client/integration_tests/k8s_test.go index d8a06db0a..5b17ac5ff 100644 --- a/grid-client/integration_tests/k8s_test.go +++ b/grid-client/integration_tests/k8s_test.go @@ -77,51 +77,27 @@ func TestK8sDeployment(t *testing.T) { err = tfPluginClient.NetworkDeployer.Cancel(context.Background(), &network) require.NoError(t, err) }) - masterSeed, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - - workerNodeSeed1, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - workerNodeSeed2, err := workloads.RandomMyceliumIPSeed() + masterVM, err := generateBasicVM(fmt.Sprintf("master_%s", generateRandString(5)), masterNodeID, network.Name, "") require.NoError(t, err) master := workloads.K8sNode{ - VM: &workloads.VM{ - Name: fmt.Sprintf("master_%s", generateRandString(5)), - NodeID: masterNodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - Planetary: true, - MyceliumIPSeed: masterSeed, - }, + VM: &masterVM, DiskSizeGB: 1, } + vm1, err := generateBasicVM(fmt.Sprintf("worker1_%s", generateRandString(5)), workerNodeID, network.Name, "") + require.NoError(t, err) + workerNodeData1 := workloads.K8sNode{ - VM: &workloads.VM{ - Name: fmt.Sprintf("worker1_%s", generateRandString(5)), - NodeID: workerNodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - Planetary: true, - MyceliumIPSeed: workerNodeSeed1, - }, + VM: &vm1, DiskSizeGB: 1, } + vm2, err := generateBasicVM(fmt.Sprintf("worker2_%s", generateRandString(5)), workerNodeID, network.Name, "") + require.NoError(t, err) workerNodeData2 := workloads.K8sNode{ - VM: &workloads.VM{ - Name: fmt.Sprintf("worker2_%s", generateRandString(5)), - NodeID: workerNodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - Planetary: true, - MyceliumIPSeed: workerNodeSeed2, - }, + VM: &vm2, DiskSizeGB: 1, } diff --git a/grid-client/integration_tests/qsfs_test.go b/grid-client/integration_tests/qsfs_test.go index 8d91aa443..1fe750e95 100644 --- a/grid-client/integration_tests/qsfs_test.go +++ b/grid-client/integration_tests/qsfs_test.go @@ -152,9 +152,8 @@ func TestQSFSDeployment(t *testing.T) { } vm, err := generateBasicVM("vm", nodeID, network.Name, publicKey) - if err != nil { - t.Skipf("vm creation failed: %v", err) - } + require.NoError(t, err) + vm.Mounts = []workloads.Mount{ {Name: qsfs.Name, MountPoint: "/qsfs"}, } diff --git a/grid-client/integration_tests/two_vms_same_network_test.go b/grid-client/integration_tests/two_vms_same_network_test.go index bafaeef5f..3d8d0f75a 100644 --- a/grid-client/integration_tests/two_vms_same_network_test.go +++ b/grid-client/integration_tests/two_vms_same_network_test.go @@ -39,43 +39,21 @@ func TestTwoVMsSameNetworkWithPublicIPV6(t *testing.T) { network, err := generateBasicNetwork([]uint32{nodeID}) require.NoError(t, err) - myCeliumSeed1, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - - vm1 := workloads.VM{ - Name: "vm1", - NodeID: nodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - Flist: "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist", - Entrypoint: "/sbin/zinit init", - EnvVars: map[string]string{ - "SSH_KEY": publicKey, - }, - MyceliumIPSeed: myCeliumSeed1, - RootfsSizeMB: minRootfs * 1024, - PublicIP6: true, - } + ubuntuFlist := "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist" - myCeliumSeed2, err := workloads.RandomMyceliumIPSeed() - require.NoError(t, err) - - vm2 := workloads.VM{ - Name: "vm2", - NodeID: nodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - Flist: "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist", - Entrypoint: "/sbin/zinit init", - EnvVars: map[string]string{ - "SSH_KEY": publicKey, - }, - MyceliumIPSeed: myCeliumSeed2, - RootfsSizeMB: minRootfs * 1024, - PublicIP6: true, - } + vm1, err := generateBasicVM("vm1", nodeID, network.Name, publicKey) + require.NoError(t, err) + + vm1.Flist = ubuntuFlist + vm1.RootfsSizeMB = minRootfs * 1024 + vm1.PublicIP6 = true + + vm2, err := generateBasicVM("vm2", nodeID, network.Name, publicKey) + require.NoError(t, err) + + vm2.Flist = ubuntuFlist + vm2.RootfsSizeMB = minRootfs * 1024 + vm2.PublicIP6 = true err = tfPluginClient.NetworkDeployer.Deploy(context.Background(), &network) require.NoError(t, err) diff --git a/grid-client/integration_tests/vm_gpu_test.go b/grid-client/integration_tests/vm_gpu_test.go index 2c2635388..662e8b719 100644 --- a/grid-client/integration_tests/vm_gpu_test.go +++ b/grid-client/integration_tests/vm_gpu_test.go @@ -60,27 +60,17 @@ func TestVMWithGPUDeployment(t *testing.T) { SizeGB: 20, } - myCeliumSeed, err := workloads.RandomMyceliumIPSeed() + vm, err := generateBasicVM("gpu", nodeID, network.Name, publicKey) require.NoError(t, err) - vm := workloads.VM{ - Name: "gpu", - NodeID: nodeID, - NetworkName: network.Name, - CPU: 4, - MemoryMB: 1024 * 8, - RootfsSizeMB: minRootfs * 1024, - Planetary: true, - GPUs: ConvertGPUsToStr(gpus), - Flist: "https://hub.grid.tf/tf-official-vms/ubuntu-22.04.flist", - Entrypoint: "/init.sh", - EnvVars: map[string]string{ - "SSH_KEY": publicKey, - }, - Mounts: []workloads.Mount{ - {Name: disk.Name, MountPoint: "/data"}, - }, - MyceliumIPSeed: myCeliumSeed, + vm.CPU = 4 + vm.MemoryMB = 1024 * 8 + vm.RootfsSizeMB = minRootfs * 1024 + vm.GPUs = ConvertGPUsToStr(gpus) + vm.Flist = "https://hub.grid.tf/tf-official-vms/ubuntu-22.04.flist" + vm.Entrypoint = "/init.sh" + vm.Mounts = []workloads.Mount{ + {Name: disk.Name, MountPoint: "/data"}, } err = tfPluginClient.NetworkDeployer.Deploy(context.Background(), &network) diff --git a/grid-client/integration_tests/vm_public_ip_test.go b/grid-client/integration_tests/vm_public_ip_test.go index 7ed56c8b6..aa000edc7 100644 --- a/grid-client/integration_tests/vm_public_ip_test.go +++ b/grid-client/integration_tests/vm_public_ip_test.go @@ -39,26 +39,12 @@ func TestVMDeployment(t *testing.T) { network, err := generateBasicNetwork([]uint32{nodeID}) require.NoError(t, err) - myCeliumSeed, err := workloads.RandomMyceliumIPSeed() + vm, err := generateBasicVM("vm", nodeID, network.Name, publicKey) require.NoError(t, err) - vm := workloads.VM{ - Name: "vm", - NodeID: nodeID, - NetworkName: network.Name, - IP: "10.20.2.5", - CPU: minCPU, - MemoryMB: minMemory * 1024, - RootfsSizeMB: minRootfs * 1024, - PublicIP: true, - Planetary: true, - Flist: "https://hub.grid.tf/tf-official-apps/base:latest.flist", - Entrypoint: "/sbin/zinit init", - EnvVars: map[string]string{ - "SSH_KEY": publicKey, - }, - MyceliumIPSeed: myCeliumSeed, - } + vm.IP = "10.20.2.5" + vm.RootfsSizeMB = minRootfs * 1024 + vm.PublicIP = true err = tfPluginClient.NetworkDeployer.Deploy(context.Background(), &network) require.NoError(t, err) diff --git a/grid-client/integration_tests/vm_volume_test.go b/grid-client/integration_tests/vm_volume_test.go index 2990de510..e55e52a02 100644 --- a/grid-client/integration_tests/vm_volume_test.go +++ b/grid-client/integration_tests/vm_volume_test.go @@ -42,26 +42,13 @@ func TestVMWithVolume(t *testing.T) { Name: "volume", SizeGB: 1, } - myCeliumSeed, err := workloads.RandomMyceliumIPSeed() + + vm, err := generateBasicVM("vm", nodeID, network.Name, publicKey) require.NoError(t, err) - vm := workloads.VM{ - Name: "vm", - NodeID: nodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - RootfsSizeMB: minRootfs * 1024, - Planetary: true, - Flist: "https://hub.grid.tf/tf-official-apps/base:latest.flist", - Entrypoint: "/sbin/zinit init", - EnvVars: map[string]string{ - "SSH_KEY": publicKey, - }, - Mounts: []workloads.Mount{ - {Name: volume.Name, MountPoint: "/volume"}, - }, - MyceliumIPSeed: myCeliumSeed, + vm.RootfsSizeMB = minRootfs * 1024 + vm.Mounts = []workloads.Mount{ + {Name: volume.Name, MountPoint: "/volume"}, } err = tfPluginClient.NetworkDeployer.Deploy(context.Background(), &network) diff --git a/grid-client/integration_tests/vms_private_ips_test.go b/grid-client/integration_tests/vms_private_ips_test.go index 33a3ff97b..245273a05 100644 --- a/grid-client/integration_tests/vms_private_ips_test.go +++ b/grid-client/integration_tests/vms_private_ips_test.go @@ -42,15 +42,10 @@ func TestDeploymentsDeploy(t *testing.T) { network, err := generateBasicNetwork([]uint32{nodeID}) require.NoError(t, err) - vm1 := workloads.VM{ - Name: vm1Name, - NodeID: nodeID, - NetworkName: network.Name, - CPU: minCPU, - MemoryMB: minMemory * 1024, - Flist: "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist", - Entrypoint: "/sbin/zinit init", - } + vm1, err := generateBasicVM(vm1Name, nodeID, network.Name, "") + require.NoError(t, err) + + vm1.Flist = "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist" err = tfPluginClient.NetworkDeployer.Deploy(context.Background(), &network) if err != nil {