Skip to content

Commit

Permalink
Merge pull request #3552 from kubevirt-bot/cherry-pick-3526-to-releas…
Browse files Browse the repository at this point in the history
…e-0.30

[release-0.30] Fix flaky pause/unpause test
  • Loading branch information
kubevirt-bot committed Jun 17, 2020
2 parents 74627cf + 9146661 commit 457a041
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions tests/pausing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
package tests_test

import (
"fmt"
"strings"
"time"

"k8s.io/apimachinery/pkg/util/intstr"

"kubevirt.io/client-go/log"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

Expand Down Expand Up @@ -364,29 +365,25 @@ var _ = Describe("[rfe_id:3064][crit:medium][vendor:cnv-qe@redhat.com][level:com
By("Start a long running process")
res, err := expecter.ExpectBatch([]expect.Batcher{
&expect.BSnd{S: "sleep 5&\n"},
&expect.BExp{R: ".*\n"}, // command
&expect.BExp{R: ".*\n"}, // result
&expect.BExp{R: ".*# "}, // prompt
&expect.BExp{R: "# "}, // prompt
&expect.BSnd{S: `pgrep -f "sleep 5"` + "\n"},
&expect.BExp{R: ".*\n"}, // command
&expect.BExp{R: ".*\n"}, // result
&expect.BExp{R: ".*# "}, // prompt
&expect.BExp{R: "sleep 5"}, // command
&expect.BExp{R: "[0-9]+\r\n"}, // pid
}, 15*time.Second)
log.DefaultLogger().Infof("a:%+v\n", res)
Expect(err).ToNot(HaveOccurred())
fmt.Fprintf(GinkgoWriter, "a:%+v\n", res)
return strings.TrimSpace(res[4].Match[0])
return strings.TrimSpace(res[2].Match[0])
}

checkProcess := func(expecter expect.Expecter) string {
By("Checking the long running process")
res, err := expecter.ExpectBatch([]expect.Batcher{
&expect.BSnd{S: `pgrep -f "sleep 5"` + "\n"},
&expect.BExp{R: ".*\n"}, // command
&expect.BExp{R: ".*\n"}, // result
&expect.BExp{R: ".*# "}, // prompt
&expect.BExp{R: "sleep 5"}, // command
&expect.BExp{R: "[0-9]+\r\n"}, // pid
}, 15*time.Second)
log.DefaultLogger().Infof("a:%+v\n", res)
Expect(err).ToNot(HaveOccurred())
fmt.Fprintf(GinkgoWriter, "b:%+v\n", res)
return strings.TrimSpace(res[1].Match[0])
}

Expand Down

0 comments on commit 457a041

Please sign in to comment.