fix: jobs
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"backend/pkg/utils"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"github.com/spf13/afero"
|
||||
_ "go.beyondstorage.io/services/fs/v4"
|
||||
"go.beyondstorage.io/v5/services"
|
||||
"go.beyondstorage.io/v5/types"
|
||||
)
|
||||
|
||||
func Test_mkdir(t *testing.T) {
|
||||
@@ -24,3 +31,52 @@ func Test_mkdir(t *testing.T) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func Test_storage(t *testing.T) {
|
||||
Convey("Test storage", t, func() {
|
||||
Convey("local fs", func() {
|
||||
store, err := services.NewStoragerFromString("fs:///mnt/yangpingliang/publish/")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
lst, err := store.List("")
|
||||
So(err, ShouldBeNil)
|
||||
for {
|
||||
o, err := lst.Next()
|
||||
if err != nil && !errors.Is(err, types.IterateDone) {
|
||||
break
|
||||
}
|
||||
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
t.Logf("Object: %s", o.MustGetContentType())
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func Test_afero(t *testing.T) {
|
||||
Convey("Test afero", t, func() {
|
||||
Convey("local fs", func() {
|
||||
pathFs := afero.NewBasePathFs(afero.NewOsFs(), "/mnt/yangpingliang/publish/")
|
||||
|
||||
lst, err := afero.ReadDir(pathFs, "")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
for _, fi := range lst {
|
||||
k := "F"
|
||||
if fi.IsDir() {
|
||||
k = "D"
|
||||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
md5, err := utils.FileMd5(filepath.Join("/mnt/yangpingliang/publish/", fi.Name()))
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
t.Logf("[%s]%s, md5: %s", k, fi.Name(), md5)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user