Skip to content

Commit

Permalink
Add offsets to helpers methods for system tests
Browse files Browse the repository at this point in the history
[#170891417]

Signed-off-by: Gareth Smith <[email protected]>
  • Loading branch information
terminatingcode authored and totherme committed Jan 29, 2020
1 parent f3117d9 commit 717f1c7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions system/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func NewDeployment(name, manifest string) Deployment {

func (d Deployment) Deploy() {
session := d.runBosh("deploy", "--var=deployment-name="+d.Name, d.Manifest)
Eventually(session).Should(gexec.Exit(0))
EventuallyWithOffset(1, session).Should(gexec.Exit(0))
}

func (d Deployment) Delete() {
session := d.runBosh("delete-deployment")
Eventually(session).Should(gexec.Exit(0))
EventuallyWithOffset(1, session).Should(gexec.Exit(0))
}

func (d Deployment) Instance(group, index string) Instance {
Expand All @@ -59,7 +59,7 @@ func run(cmd string, args ...string) *gexec.Session {
command := exec.Command(commandPath, combinedArgs...)
session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)

Expect(err).ToNot(HaveOccurred())
ExpectWithOffset(1, err).ToNot(HaveOccurred())
return session
}

Expand All @@ -84,12 +84,12 @@ func (i Instance) Copy(sourcePath, destinationPath string) {
}

session := i.deployment.runBosh("scp", sourcePath, i.Group+"/"+i.Index+":"+destinationPath)
Eventually(session).Should(gexec.Exit(0))
EventuallyWithOffset(1, session).Should(gexec.Exit(0))
}

func (i Instance) AssertFilesExist(paths []string) {
for _, path := range paths {
cmd := i.RunCommandAs("vcap", "stat "+path)
Eventually(cmd).Should(gexec.Exit(0), fmt.Sprintf("File at %s not found on %s/%s\n", path, i.Group, i.Index))
EventuallyWithOffset(1, cmd).Should(gexec.Exit(0), fmt.Sprintf("File at %s not found on %s/%s\n", path, i.Group, i.Index))
}
}

0 comments on commit 717f1c7

Please sign in to comment.