Skip to content

Commit

Permalink
Merge pull request intel#439 from okartau/single-ssh-cmd
Browse files Browse the repository at this point in the history
test/e2e/storage/sanity.go: use single ssh cmd instead of session
  • Loading branch information
okartau authored Oct 24, 2019
2 parents 0332d08 + 34e0c74 commit 2f327f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/e2e/storage/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,10 @@ var _ = Describe("sanity", func() {

i := strings.Split(nodeID, "worker")[1]

sshcmd := fmt.Sprintf("%s/_work/%s/ssh.%s", os.Getenv("REPO_ROOT"), os.Getenv("CLUSTER"), i)
// write some data to mounted volume
ssh := exec.Command(fmt.Sprintf("%s/_work/%s/ssh.%s", os.Getenv("REPO_ROOT"), os.Getenv("CLUSTER"), i))
ssh.Stdin = bytes.NewBufferString(`sudo sh -c 'echo -n "hello" > ` + v.getTargetPath() + "/target/test-file" + `'`)
cmd := "sudo sh -c 'echo -n hello > " + v.getTargetPath() + "/target/test-file'"
ssh := exec.Command(sshcmd, cmd)
out, err := ssh.CombinedOutput()
framework.ExpectNoError(err, "write failure:\n%s", string(out))

Expand All @@ -555,8 +556,8 @@ var _ = Describe("sanity", func() {
v.publish(volName, vol)

// ensure the data retained
ssh = exec.Command(fmt.Sprintf("%s/_work/%s/ssh.%s", os.Getenv("REPO_ROOT"), os.Getenv("CLUSTER"), i))
ssh.Stdin = bytes.NewBufferString(`sudo sh -c 'cat ` + v.getTargetPath() + "/target/test-file" + `'`)
cmd = "sudo cat " + v.getTargetPath() + "/target/test-file"
ssh = exec.Command(sshcmd, cmd)
out, err = ssh.CombinedOutput()
framework.ExpectNoError(err, "read failure:\n%s", string(out))
Expect(string(out)).To(Equal("hello"), "read failure")
Expand Down

0 comments on commit 2f327f7

Please sign in to comment.