forked from Jonathan-Rosenberg/delta-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblob_test.go
39 lines (30 loc) · 842 Bytes
/
blob_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package util
import (
"fmt"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
_ "gocloud.dev/blob/azureblob"
_ "gocloud.dev/blob/fileblob"
)
func Test_LocalBlobDir(t *testing.T) {
path, err := filepath.Abs("../../tests/golden/")
assert.NoError(t, err)
urlstr := fmt.Sprintf("file://%s?metadata=skip", path)
bd, err := NewBlobDir(urlstr)
assert.NoError(t, err)
// create temp folder
tempDir, placeHolder, err := bd.CreateTemp()
assert.NoError(t, err)
assert.NotEmpty(t, placeHolder)
assert.NotEmpty(t, tempDir)
// clean up temp folder
err = bd.Delete(tempDir, []string{placeHolder}, true)
assert.NoError(t, err)
// copy from a folder
newDir, files, err := bd.Copy("checkpoint")
assert.NoError(t, err)
assert.Equal(t, 18, len(files))
err = bd.Delete(newDir, files, true)
assert.NoError(t, err)
}