Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion test/e2e/release/current_release_smoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ func (t *currentReleaseSmokeTest) verifyIPerfContinuityAfterUpgrade() {
By("Stopping the long-running iperf client after upgrade")
stopIPerfClient(t.framework, t.iperfClient.vm)

By("Waiting for the iperf server to be live-migrated by the upgrade")
iperfServer := waitForIPerfServerMigration(t.framework, t.iperfServer.vm.Namespace, t.iperfServer.vm.Name)

By("Validating the iperf report spans the module upgrade")
iperfServer := t.getVirtualMachine(t.iperfServer.vm.Name, t.iperfServer.vm.Namespace)
report := getIPerfClientReport(t.framework, t.iperfClient.vm, releaseIPerfReportPath, iperfServer)
Expect(isExpectedIPerfReportError(report.Error)).To(BeTrue(), "iperf3 report contains an unexpected error: %q", report.Error)

Expand Down
29 changes: 29 additions & 0 deletions test/e2e/release/iperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ limitations under the License.
package release

import (
"context"
"encoding/json"
"fmt"
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/deckhouse/virtualization/api/core/v1alpha2"
"github.com/deckhouse/virtualization/test/e2e/internal/framework"
Expand Down Expand Up @@ -117,6 +119,31 @@ func stopIPerfClient(f *framework.Framework, vm *v1alpha2.VirtualMachine) {
}).WithTimeout(framework.MiddleTimeout).WithPolling(framework.PollingInterval).Should(Succeed())
}

func waitForIPerfServerMigration(f *framework.Framework, namespace, name string) *v1alpha2.VirtualMachine {
GinkgoHelper()

var iperfServer *v1alpha2.VirtualMachine
Eventually(func() error {
vm, err := f.Clients.VirtClient().VirtualMachines(namespace).Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
return err
}
if vm.Status.MigrationState == nil {
return fmt.Errorf("virtual machine %s/%s has not been migrated yet", namespace, name)
}
if vm.Status.MigrationState.Result != v1alpha2.MigrationResultSucceeded {
return fmt.Errorf("virtual machine %s/%s migration is not succeeded yet: %q", namespace, name, vm.Status.MigrationState.Result)
}
if vm.Status.MigrationState.StartTimestamp.IsZero() || vm.Status.MigrationState.EndTimestamp.IsZero() {
return fmt.Errorf("virtual machine %s/%s migration timestamps are not set yet", namespace, name)
}
iperfServer = vm
return nil
}).WithTimeout(framework.MaxTimeout).WithPolling(framework.PollingInterval).Should(Succeed())

return iperfServer
}

func getIPerfClientReport(f *framework.Framework, vm *v1alpha2.VirtualMachine, reportPath string, iperfServer *v1alpha2.VirtualMachine) *iperfReport {
GinkgoHelper()

Expand All @@ -140,6 +167,8 @@ func getIPerfClientReport(f *framework.Framework, vm *v1alpha2.VirtualMachine, r

Expect(result).NotTo(BeNil())

Expect(iperfServer.Status.MigrationState).NotTo(BeNil(), "iperf server VM was not migrated during the upgrade")

iPerfClientStartTime, err := time.Parse(time.RFC1123, result.Start.Timestamp.Time)
Expect(err).NotTo(HaveOccurred())
Expect(iPerfClientStartTime.Before(iperfServer.Status.MigrationState.StartTimestamp.Time)).To(BeTrue(), "the iPerfClient connection test should start before the virtual machine is migrated")
Expand Down
Loading