mirror of
https://github.com/rclone/rclone.git
synced 2024-12-25 00:19:13 +01:00
ccecfa9cb1
changes: - chunker: remove GetTier and SetTier - remove wdmrcompat metaformat - remove fastopen strategy - make hash_type option non-advanced - adverise hash support when possible - add metadata field "ver", run strict checks - describe internal behavior in comments - improve documentation note: wdmrcompat used to write file name in the metadata, so maximum metadata size was 1K; removing it allows to cap size by 200 bytes now.
59 lines
1.7 KiB
Go
59 lines
1.7 KiB
Go
// Test the Chunker filesystem interface
|
|
package chunker_test
|
|
|
|
import (
|
|
"flag"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
_ "github.com/rclone/rclone/backend/all" // for integration tests
|
|
"github.com/rclone/rclone/backend/chunker"
|
|
"github.com/rclone/rclone/fstest"
|
|
"github.com/rclone/rclone/fstest/fstests"
|
|
)
|
|
|
|
// Command line flags
|
|
var (
|
|
// Invalid characters are not supported by some remotes, eg. Mailru.
|
|
// We enable testing with invalid characters when -remote is not set, so
|
|
// chunker overlays a local directory, but invalid characters are disabled
|
|
// by default when -remote is set, eg. when test_all runs backend tests.
|
|
// You can still test with invalid characters using the below flag.
|
|
UseBadChars = flag.Bool("bad-chars", false, "Set to test bad characters in file names when -remote is set")
|
|
)
|
|
|
|
// TestIntegration runs integration tests against a concrete remote
|
|
// set by the -remote flag. If the flag is not set, it creates a
|
|
// dynamic chunker overlay wrapping a local temporary directory.
|
|
func TestIntegration(t *testing.T) {
|
|
opt := fstests.Opt{
|
|
RemoteName: *fstest.RemoteName,
|
|
NilObject: (*chunker.Object)(nil),
|
|
SkipBadWindowsCharacters: !*UseBadChars,
|
|
UnimplementableObjectMethods: []string{
|
|
"MimeType",
|
|
"GetTier",
|
|
"SetTier",
|
|
},
|
|
UnimplementableFsMethods: []string{
|
|
"PublicLink",
|
|
"OpenWriterAt",
|
|
"MergeDirs",
|
|
"DirCacheFlush",
|
|
"UserInfo",
|
|
"Disconnect",
|
|
},
|
|
}
|
|
if *fstest.RemoteName == "" {
|
|
name := "TestChunker"
|
|
opt.RemoteName = name + ":"
|
|
tempDir := filepath.Join(os.TempDir(), "rclone-chunker-test-standard")
|
|
opt.ExtraConfig = []fstests.ExtraConfigItem{
|
|
{Name: name, Key: "type", Value: "chunker"},
|
|
{Name: name, Key: "remote", Value: tempDir},
|
|
}
|
|
}
|
|
fstests.Run(t, &opt)
|
|
}
|