mirror of
https://github.com/rclone/rclone.git
synced 2025-12-19 09:43:14 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a80287effd | ||
|
|
4216d55a05 |
@@ -44,6 +44,7 @@ func TestIntegration(t *testing.T) {
|
|||||||
"UserInfo",
|
"UserInfo",
|
||||||
"Disconnect",
|
"Disconnect",
|
||||||
},
|
},
|
||||||
|
QuickTestOK: true,
|
||||||
}
|
}
|
||||||
if *fstest.RemoteName == "" {
|
if *fstest.RemoteName == "" {
|
||||||
name := "TestChunker"
|
name := "TestChunker"
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ import (
|
|||||||
|
|
||||||
// TestIntegration runs integration tests against the remote
|
// TestIntegration runs integration tests against the remote
|
||||||
func TestIntegration(t *testing.T) {
|
func TestIntegration(t *testing.T) {
|
||||||
|
if *fstest.RemoteName == "" {
|
||||||
|
t.Skip("Skipping as -remote not set")
|
||||||
|
}
|
||||||
opt := fstests.Opt{
|
opt := fstests.Opt{
|
||||||
RemoteName: *fstest.RemoteName,
|
RemoteName: *fstest.RemoteName,
|
||||||
NilObject: (*Object)(nil),
|
NilObject: (*Object)(nil),
|
||||||
@@ -61,5 +64,6 @@ func TestRemoteGzip(t *testing.T) {
|
|||||||
{Name: name, Key: "remote", Value: tempdir},
|
{Name: name, Key: "remote", Value: tempdir},
|
||||||
{Name: name, Key: "compression_mode", Value: "gzip"},
|
{Name: name, Key: "compression_mode", Value: "gzip"},
|
||||||
},
|
},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1049,6 +1049,10 @@ func (o *ObjectInfo) Hash(ctx context.Context, hash hash.Type) (string, error) {
|
|||||||
}
|
}
|
||||||
// if this is wrapping a local object then we work out the hash
|
// if this is wrapping a local object then we work out the hash
|
||||||
if srcObj.Fs().Features().IsLocal {
|
if srcObj.Fs().Features().IsLocal {
|
||||||
|
if o.f.opt.NoDataEncryption {
|
||||||
|
// If no encryption, just return the hash of the underlying object
|
||||||
|
return srcObj.Hash(ctx, hash)
|
||||||
|
}
|
||||||
// Read the data and encrypt it to calculate the hash
|
// Read the data and encrypt it to calculate the hash
|
||||||
fs.Debugf(o, "Computing %v hash of encrypted source", hash)
|
fs.Debugf(o, "Computing %v hash of encrypted source", hash)
|
||||||
return o.f.computeHashWithNonce(ctx, o.nonce, srcObj, hash)
|
return o.f.computeHashWithNonce(ctx, o.nonce, srcObj, hash)
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ func testObjectInfo(t *testing.T, f *Fs, wrap bool) {
|
|||||||
enc, err := f.cipher.newEncrypter(inBuf, nil)
|
enc, err := f.cipher.newEncrypter(inBuf, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
nonce := enc.nonce // read the nonce at the start
|
nonce := enc.nonce // read the nonce at the start
|
||||||
_, err = io.Copy(&outBuf, enc)
|
if f.opt.NoDataEncryption {
|
||||||
|
_, err = outBuf.WriteString(contents)
|
||||||
|
} else {
|
||||||
|
_, err = io.Copy(&outBuf, enc)
|
||||||
|
}
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
var oi fs.ObjectInfo = obj
|
var oi fs.ObjectInfo = obj
|
||||||
@@ -96,7 +100,12 @@ func testObjectInfo(t *testing.T, f *Fs, wrap bool) {
|
|||||||
assert.NotEqual(t, path, src.Remote())
|
assert.NotEqual(t, path, src.Remote())
|
||||||
|
|
||||||
// Test ObjectInfo.Hash
|
// Test ObjectInfo.Hash
|
||||||
wantHash := md5.Sum(outBuf.Bytes())
|
var wantHash [md5.Size]byte
|
||||||
|
if f.opt.NoDataEncryption {
|
||||||
|
wantHash = md5.Sum([]byte(contents))
|
||||||
|
} else {
|
||||||
|
wantHash = md5.Sum(outBuf.Bytes())
|
||||||
|
}
|
||||||
gotHash, err := src.Hash(ctx, hash.MD5)
|
gotHash, err := src.Hash(ctx, hash.MD5)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, fmt.Sprintf("%x", wantHash), gotHash)
|
assert.Equal(t, fmt.Sprintf("%x", wantHash), gotHash)
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ func TestStandardBase32(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +68,7 @@ func TestStandardBase64(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,6 +90,7 @@ func TestStandardBase32768(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +112,7 @@ func TestOff(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +135,7 @@ func TestObfuscate(t *testing.T) {
|
|||||||
SkipBadWindowsCharacters: true,
|
SkipBadWindowsCharacters: true,
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,5 +159,6 @@ func TestNoDataObfuscate(t *testing.T) {
|
|||||||
SkipBadWindowsCharacters: true,
|
SkipBadWindowsCharacters: true,
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
UnimplementableFsMethods: []string{"OpenWriterAt"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ func TestIntegration(t *testing.T) {
|
|||||||
"OpenWriterAt",
|
"OpenWriterAt",
|
||||||
},
|
},
|
||||||
UnimplementableObjectMethods: []string{},
|
UnimplementableObjectMethods: []string{},
|
||||||
|
QuickTestOK: true,
|
||||||
}
|
}
|
||||||
if *fstest.RemoteName == "" {
|
if *fstest.RemoteName == "" {
|
||||||
tempDir := filepath.Join(os.TempDir(), "rclone-hasher-test")
|
tempDir := filepath.Join(os.TempDir(), "rclone-hasher-test")
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import (
|
|||||||
// TestIntegration runs integration tests against the remote
|
// TestIntegration runs integration tests against the remote
|
||||||
func TestIntegration(t *testing.T) {
|
func TestIntegration(t *testing.T) {
|
||||||
fstests.Run(t, &fstests.Opt{
|
fstests.Run(t, &fstests.Opt{
|
||||||
RemoteName: "",
|
RemoteName: "",
|
||||||
NilObject: (*local.Object)(nil),
|
NilObject: (*local.Object)(nil),
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import (
|
|||||||
// TestIntegration runs integration tests against the remote
|
// TestIntegration runs integration tests against the remote
|
||||||
func TestIntegration(t *testing.T) {
|
func TestIntegration(t *testing.T) {
|
||||||
fstests.Run(t, &fstests.Opt{
|
fstests.Run(t, &fstests.Opt{
|
||||||
RemoteName: ":memory:",
|
RemoteName: ":memory:",
|
||||||
NilObject: (*Object)(nil),
|
NilObject: (*Object)(nil),
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ func TestStandard(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ func TestRO(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +88,7 @@ func TestNC(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +111,7 @@ func TestPolicy1(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,6 +134,7 @@ func TestPolicy2(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,5 +157,6 @@ func TestPolicy3(t *testing.T) {
|
|||||||
},
|
},
|
||||||
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
UnimplementableFsMethods: []string{"OpenWriterAt", "DuplicateFiles"},
|
||||||
UnimplementableObjectMethods: []string{"MimeType"},
|
UnimplementableObjectMethods: []string{"MimeType"},
|
||||||
|
QuickTestOK: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ type Opt struct {
|
|||||||
SkipFsCheckWrap bool // if set skip FsCheckWrap
|
SkipFsCheckWrap bool // if set skip FsCheckWrap
|
||||||
SkipObjectCheckWrap bool // if set skip ObjectCheckWrap
|
SkipObjectCheckWrap bool // if set skip ObjectCheckWrap
|
||||||
SkipInvalidUTF8 bool // if set skip invalid UTF-8 checks
|
SkipInvalidUTF8 bool // if set skip invalid UTF-8 checks
|
||||||
|
QuickTestOK bool // OK to run this test in "make quicktest"
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if x is found in ss
|
// returns true if x is found in ss
|
||||||
@@ -359,7 +360,7 @@ func Run(t *testing.T, opt *Opt) {
|
|||||||
unwrappableFsMethods = []string{"Command"} // these Fs methods don't need to be wrapped ever
|
unwrappableFsMethods = []string{"Command"} // these Fs methods don't need to be wrapped ever
|
||||||
)
|
)
|
||||||
|
|
||||||
if strings.HasSuffix(os.Getenv("RCLONE_CONFIG"), "/notfound") && *fstest.RemoteName == "" {
|
if !opt.QuickTestOK && strings.HasSuffix(os.Getenv("RCLONE_CONFIG"), "/notfound") && *fstest.RemoteName == "" {
|
||||||
t.Skip("quicktest only")
|
t.Skip("quicktest only")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user