-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: upload and download tests against vfkit
This commit adds two tests: 1. Upload files to the VM This test uploads three files of different sizes (10M, 100M, 1G) to the running VM and verifies the sha256sum of the uploaded files. 2. Download the above files from the VM This test downloads the three files uploaded in the previous test and verifies their sha256sum values. Signed-off-by: Gunjan Vyas <[email protected]>
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,33 @@ func clear() { | |
socketPath := filepath.Join(os.TempDir(), "ignition.sock") | ||
_ = os.Remove(socketPath) | ||
} | ||
func scpToVm(src, dst string) error { | ||
sshCmd := exec.Command("/usr/bin/scp", | ||
"-o", "UserKnownHostsFile=/dev/null", | ||
"-o", "StrictHostKeyChecking=no", | ||
"-o", "IdentitiesOnly=yes", | ||
"-i", privateKeyFile, | ||
"-P", strconv.Itoa(sshPort), | ||
src, fmt.Sprintf("%[email protected]:%s", ignitionUser, dst)) // #nosec G204 | ||
sshCmd.Stderr = os.Stderr | ||
sshCmd.Stdout = os.Stdout | ||
fmt.Println(sshCmd.String()) | ||
return sshCmd.Run() | ||
} | ||
|
||
func scpFromVm(src, dst string) error { | ||
sshCmd := exec.Command("/usr/bin/scp", | ||
"-o", "UserKnownHostsFile=/dev/null", | ||
"-o", "StrictHostKeyChecking=no", | ||
"-o", "IdentitiesOnly=yes", | ||
"-i", privateKeyFile, | ||
"-P", strconv.Itoa(sshPort), | ||
fmt.Sprintf("%[email protected]:%s", ignitionUser, src), dst) // #nosec G204 | ||
sshCmd.Stderr = os.Stderr | ||
sshCmd.Stdout = os.Stdout | ||
fmt.Println(sshCmd.String()) | ||
return sshCmd.Run() | ||
} | ||
|
||
var _ = ginkgo.AfterSuite(func() { | ||
if host != nil { | ||
|