Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(e2e/v2): add transfer-from-dfdaemon option for dfget test case #3832

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions test/e2e/v2/dfget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,102 @@ var _ = Describe("Download Using Dfget", func() {
})
})

Context("1MiB file and set transfer-from-dfdaemon", func() {
var (
testFile *util.File
err error
)

BeforeEach(func() {
testFile, err = util.GetFileServer().GenerateFile(util.FileSize1MiB)
Expect(err).NotTo(HaveOccurred())
Expect(testFile).NotTo(BeNil())
})

AfterEach(func() {
err = util.GetFileServer().DeleteFile(testFile.GetInfo())
Expect(err).NotTo(HaveOccurred())
})

It("download should be ok", Label("dfget", "download", "transfer-from-dfdaemon"), func() {
clientPod, err := util.ClientExec()
fmt.Println(err)
Expect(err).NotTo(HaveOccurred())

out, err := clientPod.Command("sh", "-c", fmt.Sprintf("dfget %s --disable-back-to-source --transfer-from-dfdaemon --output %s", testFile.GetDownloadURL(), testFile.GetOutputPath())).CombinedOutput()
fmt.Println(string(out), err)
Expect(err).NotTo(HaveOccurred())

sha256sum, err := util.CalculateSha256ByTaskID([]*util.PodExec{clientPod}, testFile.GetTaskID())
Expect(err).NotTo(HaveOccurred())
Expect(testFile.GetSha256()).To(Equal(sha256sum))

sha256sum, err = util.CalculateSha256ByOutput([]*util.PodExec{clientPod}, testFile.GetOutputPath())
Expect(err).NotTo(HaveOccurred())
Expect(testFile.GetSha256()).To(Equal(sha256sum))

time.Sleep(1 * time.Second)
seedClientPods := make([]*util.PodExec, 3)
for i := 0; i < 3; i++ {
seedClientPods[i], err = util.SeedClientExec(i)
fmt.Println(err)
Expect(err).NotTo(HaveOccurred())
}

sha256sum, err = util.CalculateSha256ByTaskID(seedClientPods, testFile.GetTaskID())
Expect(err).NotTo(HaveOccurred())
Expect(testFile.GetSha256()).To(Equal(sha256sum))
})
})

Context("10MiB file and set transfer-from-dfdaemon", func() {
var (
testFile *util.File
err error
)

BeforeEach(func() {
testFile, err = util.GetFileServer().GenerateFile(util.FileSize10MiB)
Expect(err).NotTo(HaveOccurred())
Expect(testFile).NotTo(BeNil())
})

AfterEach(func() {
err = util.GetFileServer().DeleteFile(testFile.GetInfo())
Expect(err).NotTo(HaveOccurred())
})

It("download should be ok", Label("dfget", "download", "transfer-from-dfdaemon"), func() {
clientPod, err := util.ClientExec()
fmt.Println(err)
Expect(err).NotTo(HaveOccurred())

out, err := clientPod.Command("sh", "-c", fmt.Sprintf("dfget %s --disable-back-to-source --transfer-from-dfdaemon --output %s", testFile.GetDownloadURL(), testFile.GetOutputPath())).CombinedOutput()
fmt.Println(string(out), err)
Expect(err).NotTo(HaveOccurred())

sha256sum, err := util.CalculateSha256ByTaskID([]*util.PodExec{clientPod}, testFile.GetTaskID())
Expect(err).NotTo(HaveOccurred())
Expect(testFile.GetSha256()).To(Equal(sha256sum))

sha256sum, err = util.CalculateSha256ByOutput([]*util.PodExec{clientPod}, testFile.GetOutputPath())
Expect(err).NotTo(HaveOccurred())
Expect(testFile.GetSha256()).To(Equal(sha256sum))

time.Sleep(1 * time.Second)
seedClientPods := make([]*util.PodExec, 3)
for i := 0; i < 3; i++ {
seedClientPods[i], err = util.SeedClientExec(i)
fmt.Println(err)
Expect(err).NotTo(HaveOccurred())
}

sha256sum, err = util.CalculateSha256ByTaskID(seedClientPods, testFile.GetTaskID())
Expect(err).NotTo(HaveOccurred())
Expect(testFile.GetSha256()).To(Equal(sha256sum))
})
})

Context("1MiB file and set application to d7y", func() {
var (
testFile *util.File
Expand Down
Loading