Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

e2e: Add test for concurrent VM creation #715

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions e2e/zconcurrent_vm_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package e2e

import (
"strconv"
"testing"

"github.com/weaveworks/ignite/e2e/util"
"gotest.tools/assert"
)

func TestConcurrentVMCreation(t *testing.T) {
assert.Assert(t, e2eHome != "", "IGNITE_E2E_HOME should be set")

igniteCmd := util.NewCommand(t, igniteBin)

numberOfVMs := 4
vmNames := []string{}
cmds := []*util.Command{}

// Create VM names and VM run commands to execute.
for i := 1; i <= numberOfVMs; i++ {
name := "e2e-test-concurrent-vm-create-" + strconv.Itoa(i)
vmNames = append(vmNames, name)
cmds = append(
cmds,
util.NewCommand(t, igniteBin).
With("run").
With("--name="+name).
With("--ssh").
With(util.DefaultVMImage),
)
}

// Clean-up the VMs.
defer igniteCmd.New().
With("rm", "-f").
With(vmNames...).
Run()

// Run VMs.
for _, cmd := range cmds {
assert.Check(t, cmd.Cmd.Start(), "failed to run VM")
}

// Wait for all the commands to finish.
for _, cmd := range cmds {
assert.Check(t, cmd.Cmd.Wait(), "error waiting for the command to finish")
}
}