hanahmily commented on code in PR #652:
URL: 
https://github.com/apache/skywalking-banyandb/pull/652#discussion_r2057174403


##########
test/cases/backup/all.go:
##########
@@ -46,18 +64,38 @@ var _ = ginkgo.Describe("Backup All", func() {
                                "--property-root-path", SharedContext.RootDir,
                                "--dest", destURL,
                                "--time-style", "daily",
+                               "--s3-credential-file", 
SharedContext.S3CredentialsPath,
+                               "--s3-config-file", SharedContext.S3ConfigPath,
                        })
                        err = backupCmd.Execute()
                        gomega.Expect(err).NotTo(gomega.HaveOccurred())
 
                        var backupTimeDir string
-                       entries, err := os.ReadDir(destDir)
-                       gomega.Expect(err).NotTo(gomega.HaveOccurred())
-                       for _, entry := range entries {
-                               if entry.IsDir() {
-                                       backupTimeDir = entry.Name()
-                                       break
+                       if fsType == "local" {
+                               entries, inErr := os.ReadDir(destDir)

Review Comment:
   Use `fs.List` to remove the "if-else" block.



##########
test/cases/backup/all.go:
##########
@@ -19,24 +19,42 @@ package backup_test
 
 import (
        "bytes"
+       "context"
        "os"
        "path/filepath"
+       "regexp"
        "strings"
 
        "github.com/onsi/ginkgo/v2"
        "github.com/onsi/gomega"
 
        "github.com/apache/skywalking-banyandb/banyand/backup"
+       "github.com/apache/skywalking-banyandb/pkg/fs/remote"
+       "github.com/apache/skywalking-banyandb/pkg/fs/remote/aws"
 )
 
 var _ = ginkgo.Describe("Backup All", func() {
        _ = ginkgo.Describe("Backup and Restore Integration", func() {
                ginkgo.It("should backup, create timedir and restore data 
correctly", func() {
+                       bucketName := SharedContext.BucketName
+                       var destURL string
+                       var fs remote.FS
+                       fsType := SharedContext.FSType
                        ginkgo.By("Backup data to a remote destination")
                        destDir, err := os.MkdirTemp("", "backup-restore-dest")
                        gomega.Expect(err).NotTo(gomega.HaveOccurred())
                        defer os.RemoveAll(destDir)
-                       destURL := "file://" + destDir
+
+                       if fsType == "local" {
+                               destURL = "file" + "://" + destDir

Review Comment:
   Move destURL to "SharedContext"



##########
test/cases/backup/all.go:
##########
@@ -46,18 +64,38 @@ var _ = ginkgo.Describe("Backup All", func() {
                                "--property-root-path", SharedContext.RootDir,
                                "--dest", destURL,
                                "--time-style", "daily",
+                               "--s3-credential-file", 
SharedContext.S3CredentialsPath,
+                               "--s3-config-file", SharedContext.S3ConfigPath,

Review Comment:
   Add []string into ShareContext to include these flags.



##########
test/cases/backup/all.go:
##########
@@ -171,6 +228,51 @@ var _ = ginkgo.Describe("Backup All", func() {
                                _, err = os.Stat(timedirFile)
                                
gomega.Expect(os.IsNotExist(err)).To(gomega.BeTrue())
                        }
+                       clearSnapshotDirs()

Review Comment:
   Use a "defer" statement to ensure that it can be invoked



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to