@@ -22,6 +22,7 @@ import (
2222 . "github.com/onsi/ginkgo/v2" //nolint
2323 . "github.com/onsi/gomega" //nolint
2424
25+ "d7y.io/dragonfly/v2/pkg/idgen"
2526 "d7y.io/dragonfly/v2/test/e2e/v2/util"
2627)
2728
@@ -60,19 +61,20 @@ var _ = Describe("Import and Export Using Dfcache", func() {
6061 Expect (err ).NotTo (HaveOccurred ())
6162 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
6263
63- importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
64+ importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --content-for-calculating-task- id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
6465 fmt .Println (string (importOut ), err )
6566 Expect (err ).NotTo (HaveOccurred ())
6667
6768 seedClientPod , err := util .SeedClientExec (0 )
6869 fmt .Println (err )
6970 Expect (err ).NotTo (HaveOccurred ())
7071
71- exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --output %s" , testFile .GetSha256 (), testFile .GetOutputPath ())).CombinedOutput ()
72+ taskID := idgen .PersistentCacheTaskIDByContent (testFile .GetSha256 ())
73+ exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --output %s" , taskID , testFile .GetOutputPath ())).CombinedOutput ()
7274 fmt .Println (string (exportOut ), err )
7375 Expect (err ).NotTo (HaveOccurred ())
7476
75- sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, testFile . GetSha256 () )
77+ sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, taskID )
7678 Expect (err ).NotTo (HaveOccurred ())
7779 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
7880
@@ -116,19 +118,20 @@ var _ = Describe("Import and Export Using Dfcache", func() {
116118 Expect (err ).NotTo (HaveOccurred ())
117119 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
118120
119- importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
121+ importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --content-for-calculating-task- id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
120122 fmt .Println (string (importOut ), err )
121123 Expect (err ).NotTo (HaveOccurred ())
122124
123125 seedClientPod , err := util .SeedClientExec (0 )
124126 fmt .Println (err )
125127 Expect (err ).NotTo (HaveOccurred ())
126128
127- exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --output %s" , testFile .GetSha256 (), testFile .GetOutputPath ())).CombinedOutput ()
129+ taskID := idgen .PersistentCacheTaskIDByContent (testFile .GetSha256 ())
130+ exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --output %s" , taskID , testFile .GetOutputPath ())).CombinedOutput ()
128131 fmt .Println (string (exportOut ), err )
129132 Expect (err ).NotTo (HaveOccurred ())
130133
131- sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, testFile . GetSha256 () )
134+ sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, taskID )
132135 Expect (err ).NotTo (HaveOccurred ())
133136 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
134137
@@ -172,19 +175,20 @@ var _ = Describe("Import and Export Using Dfcache", func() {
172175 Expect (err ).NotTo (HaveOccurred ())
173176 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
174177
175- importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
178+ importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --content-for-calculating-task- id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
176179 fmt .Println (string (importOut ), err )
177180 Expect (err ).NotTo (HaveOccurred ())
178181
179182 seedClientPod , err := util .SeedClientExec (0 )
180183 fmt .Println (err )
181184 Expect (err ).NotTo (HaveOccurred ())
182185
183- exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --output %s" , testFile .GetSha256 (), testFile .GetOutputPath ())).CombinedOutput ()
186+ taskID := idgen .PersistentCacheTaskIDByContent (testFile .GetSha256 ())
187+ exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --output %s" , taskID , testFile .GetOutputPath ())).CombinedOutput ()
184188 fmt .Println (string (exportOut ), err )
185189 Expect (err ).NotTo (HaveOccurred ())
186190
187- sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, testFile . GetSha256 () )
191+ sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, taskID )
188192 Expect (err ).NotTo (HaveOccurred ())
189193 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
190194
@@ -228,19 +232,20 @@ var _ = Describe("Import and Export Using Dfcache", func() {
228232 Expect (err ).NotTo (HaveOccurred ())
229233 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
230234
231- importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
235+ importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --content-for-calculating-task- id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
232236 fmt .Println (string (importOut ), err )
233237 Expect (err ).NotTo (HaveOccurred ())
234238
235239 seedClientPod , err := util .SeedClientExec (0 )
236240 fmt .Println (err )
237241 Expect (err ).NotTo (HaveOccurred ())
238242
239- exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --transfer-from-dfdaemon --output %s" , testFile .GetSha256 (), testFile .GetOutputPath ())).CombinedOutput ()
243+ taskID := idgen .PersistentCacheTaskIDByContent (testFile .GetSha256 ())
244+ exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --transfer-from-dfdaemon --output %s" , taskID , testFile .GetOutputPath ())).CombinedOutput ()
240245 fmt .Println (string (exportOut ), err )
241246 Expect (err ).NotTo (HaveOccurred ())
242247
243- sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, testFile . GetSha256 () )
248+ sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, taskID )
244249 Expect (err ).NotTo (HaveOccurred ())
245250 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
246251
@@ -284,19 +289,20 @@ var _ = Describe("Import and Export Using Dfcache", func() {
284289 Expect (err ).NotTo (HaveOccurred ())
285290 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
286291
287- importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
292+ importOut , err := clientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache import %s --persistent-replica-count 1 --content-for-calculating-task- id %s" , testFile .GetOutputPath (), testFile .GetSha256 ())).CombinedOutput ()
288293 fmt .Println (string (importOut ), err )
289294 Expect (err ).NotTo (HaveOccurred ())
290295
291296 seedClientPod , err := util .SeedClientExec (0 )
292297 fmt .Println (err )
293298 Expect (err ).NotTo (HaveOccurred ())
294299
295- exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --transfer-from-dfdaemon --output %s" , testFile .GetSha256 (), testFile .GetOutputPath ())).CombinedOutput ()
300+ taskID := idgen .PersistentCacheTaskIDByContent (testFile .GetSha256 ())
301+ exportOut , err := seedClientPod .Command ("sh" , "-c" , fmt .Sprintf ("dfcache export %s --transfer-from-dfdaemon --output %s" , taskID , testFile .GetOutputPath ())).CombinedOutput ()
296302 fmt .Println (string (exportOut ), err )
297303 Expect (err ).NotTo (HaveOccurred ())
298304
299- sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, testFile . GetSha256 () )
305+ sha256sum , err = util .CalculateSha256ByPersistentCacheTaskID ([]* util.PodExec {seedClientPod }, taskID )
300306 Expect (err ).NotTo (HaveOccurred ())
301307 Expect (testFile .GetSha256 ()).To (Equal (sha256sum ))
302308
0 commit comments