Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
domdom82 committed Jun 23, 2023
1 parent 1024867 commit 627b018
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
15 changes: 9 additions & 6 deletions acceptance-tests/basic_pcap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package acceptance_tests
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"os"
"os/exec"
"time"
)

var _ = Describe("Pcap Deployment", func() {
Expand All @@ -19,17 +19,20 @@ var _ = Describe("Pcap Deployment", func() {
true,
)

err := downloadFile(info, "/var/vcap/packages/pcap-api/bin/cli/build/pcap-bosh-cli-linux-amd64", "/usr/local/bin/pcap-bosh-cli", 0755)
boshCliFile, err := os.CreateTemp("", "pcap-bosh-cli-*")
Expect(err).NotTo(HaveOccurred())

time.Sleep(2 * time.Hour)
boshCli := boshCliFile.Name()

cmd := exec.Command("which", "pcap-bosh-cli")
By("Downloading remote pcap-bosh-cli-linux-amd64 to " + boshCli)
err = downloadFile(info, "/var/vcap/packages/pcap-api/bin/cli/build/pcap-bosh-cli-linux-amd64", boshCli, 0755)
Expect(err).NotTo(HaveOccurred())

cmd := exec.Command(boshCli, "--help")

helpTest, err := cmd.Output()
Expect(err).NotTo(HaveOccurred())

GinkgoLogr.Info(string(helpTest))

writeLog(string(helpTest))
})
})
2 changes: 1 addition & 1 deletion acceptance-tests/bosh_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,5 @@ func writeLog(s string) {
}

func downloadFile(info pcapAPIInfo, remotePath, localPath string, permissions os.FileMode) error {
return copyFileFromRemote(info.SSHUser, info.PublicIP, info.SSHPrivateKey, "/var/vcap/packages/pcap-api/bin/cli/build/pcap-bosh-cli-linux-amd64", "/usr/local/bin/pcap-bosh-cli", 0755)
return copyFileFromRemote(info.SSHUser, info.PublicIP, info.SSHPrivateKey, remotePath, localPath, permissions)
}
8 changes: 7 additions & 1 deletion acceptance-tests/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ func copyFileFromRemote(user string, addr string, privateKey string, remotePath
return err
}

return scpClient.CopyFromRemote(context.Background(), localFile, remotePath)
err = scpClient.CopyFromRemote(context.Background(), localFile, remotePath)

if err != nil {
return err
}

return localFile.Sync()
}

// Forwards a TCP connection from a given port on the local machine to a given port on the remote machine
Expand Down

0 comments on commit 627b018

Please sign in to comment.