test(general): parse stdout and stderr in robustness framework helper (#2779)

Parse stdout as well as stderr in `KopiaSnapshotter.CreateSnapshot`.
This is contained to the Robustness Framework.

Co-authored-by: Carl Braganza <carl@kasten.io>
This commit is contained in:
Julio LopezandCarl Braganza authored and GitHub committed 2023-02-23 10:18:07 -08:00
1 parent fdb386154a
commit 5c901abc90
1 file changed
+5 -1
+5 -1
View File
@@ -132,11 +132,15 @@ func (ks *KopiaSnapshotter) ConnectOrCreateFilesystem(repoPath string) error {
// CreateSnapshot implements the Snapshotter interface, issues a kopia snapshot
// create command on the provided source path.
func (ks *KopiaSnapshotter) CreateSnapshot(source string) (snapID string, err error) {
_, errOut, err := ks.Runner.Run("snapshot", "create", parallelFlag, strconv.Itoa(parallelSetting), noProgressFlag, source)
stdOut, errOut, err := ks.Runner.Run("snapshot", "create", parallelFlag, strconv.Itoa(parallelSetting), noProgressFlag, source)
if err != nil {
return "", err
}
if stdOut != "" {
return parseSnapID(strings.Split(stdOut, "\n"))
}
return parseSnapID(strings.Split(errOut, "\n"))
}