rclone: Integration test breakage

It looks like the mega merge has broken some integration tests 😦

I’m pretty sure that these are a consequence of your changes @nielash - can you take a look?

suite test
fs/sync TestFixCase
fs/operations TestCaseInsensitiveMoveFileDryRun
fs/operations TestApplyTransforms

To run the tests for a suite do this

cd fs/sync
go test -v -run TestFixCase -remote TestWhicheverFails:

To see which remotes to try see the integration test results here: https://pub.rclone.org/integration-tests/current/ (these are generated daily). I would test and fix one remote and hope that the fix works for the others!

These ones were broken before the merge but need fixing too - I @ncw - will do these.

suite test
backend TestIntegration/FsMkdir/FsPutFiles/FsIsFile/FsRoot

The other breakages are known about.

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don’t comment if you have no relevant information to add. It’s just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Yes that looks much better. I just need to fix the Error IsFile Root ones and then we should be back below 10 failures again before I merge the directory modtime/ metadata which is bound to break more stuff!

Update: the latest fixes have helped a lot. We’re down to just a few outliers now.

Add in an override in config.yaml is probably what I’d do at this point!

  • mailru (and chunker wrapping mailru): The error is:
Failed to put "測試_Русский___ě_áñ" to "[rclone-test-cubumak9yoneric9nupaneb3]": invalid characters in object name

So it seems like maybe the backend’s MultiEncoder defaults are set incorrectly, as it is trying to PUT a filename that mailru won’t accept. I’m not sure exactly which characters mailru doesn’t like (but I’m guessing it’s not the Russian ones!)

The encoder only really works for ASCII punctuation. It doesn’t deal with other sorts of replacements. Not sure what to do about this

A bit of testing indicates that mailru doesn’t like any of the accented characters йěáñ

>>> s="йěáñ"
>>> s
'йěáñ'
>>> s.encode("utf-8")
b'\xd0\xb8\xcc\x86e\xcc\x8ca\xcc\x81n\xcc\x83'

It is the combining characters it doesn’t like by the look of it

>>> for i in s: print(hex(ord(i)))
... 
0x438
0x306
0x65
0x30c
0x61
0x301
0x6e
0x303

I guess mailru just can’t cope with this, so I’d mark it so in config.yaml

  • OpenDrive: The error is:
EXISTING: Couldn't move: You cannot move or copy file to same folder (Error 403)
...
DirMove error File or folder with such name already exists (Error 409)

I am not too familiar with OpenDrive, but I looked into this a little bit and I think the problem might be that we are using the wrong API operation. We are using /file/move_copy.json, but OpenDrive has a separate /file/rename.json for renaming files within the same directory (p. 22 of the API guide) and likewise /folder/rename.json for directories (p. 37). So, I think perhaps the backend should be checking whether the move is within the same directory and using rename instead of move_copy if so. Does that sound plausible to you, and would you like me to try to implement that? (It seems a little surprising to me that this wouldn’t have come up before, including on other tests…)

I suspect that the opendrive API has improved since the backend was written…

Yes your fix seems like the correct one if you want to have a go 😃

In general you should always use cache.Get instead of calling NewFs directly. That said, we are going to ditch that code path so this is just an FYI!

Thanks, good to know!

Backends don’t share directory caches for quite a few reasons. The main one is that it is difficult to tell whether backends are pointing to the same thing, and if the root is different the contents of the directory cache will be different.

Makes sense, thanks for clarifying!

it is difficult to tell whether backends are pointing to the same thing

I noticed this recently while experimenting with making a new wrapping backend! It was surprising to me coming from the user side where the remote:path/subpath syntax always makes it totally clear where we are relative to the (same) root. I found myself wishing there was something that simple for an Fs! Maybe whatever is replacing cache.Get will bring one.

Note that linkbox has some overrides in the integration test config

I think the one for TestCaseInsensitiveMoveFile is telling… that’s exactly what --fix-case needs to do! So if that was deemed impossible, I suspect we’ll reach the same conclusion here.

That fix looks OK if we need it, but I think we probably won’t with DirMove.

I agree.

Happy for you to merge fixes for integration tests when you are happy with them.

Sounds good! I’ll do that now and check the results tomorrow 😅

Would cache.Get be a better choice?

In general you should always use cache.Get instead of calling NewFs directly. That said, we are going to ditch that code path so this is just an FYI!

  • The filepath.Join look wrong - rclone paths are always unix paths so this should be path.Join or possibly even fspath.Join

That’s actually what I had originally, but then it errored on windows because of the \.

Odd but we are probably ditching that bit too!

What change would you propose in the directory cache code to fix it?

I’m not quite sure yet. This may just be expected behavior, but I think the thing that is surprising to me is that the caller would need to be concerned with tracking which Fs’s have been flushed and when… I’d have expected the backend to manage that independently, so that the outcome doesn’t change depending on where in your code you call NewFs. I guess I assumed I had a pointer to some shared cache, instead of a copy.

Backends don’t share directory caches for quite a few reasons. The main one is that it is difficult to tell whether backends are pointing to the same thing, and if the root is different the contents of the directory cache will be different.

TestApplyTransforms

Yes, I think we should go ahead with nielash@da487ba. I tested it with Dropbox just now and confirmed this is the issue:

Sounds good to me.

TestCaseInsensitiveMoveFileDryRun

This one appears to be fixed now.

😃

TestFixCase

The two outliers here are jottacloud and linkbox. jottacloud has a relavant known issue and is failing before it even gets to the real test. It appears to be not only case-insensitive but also not even case-preserving (we’re putting EXISTING and it is returning existing.) So, I don’t think it is actually capable of supporting --fix-case, and it probably needs either an exception or to be skipped with a meta-test similar to nielash@da487ba.

linkbox seems to be failing all kinds of encoding tests at the moment:

TestIntegration/FsMkdir/FsEncoding/leading_dot, TestIntegration/FsMkdir/FsEncoding/trailing_space, TestIntegration/FsMkdir/FsEncoding/trailing_CR, TestIntegration/FsMkdir/FsEncoding/trailing_LF, TestIntegration/FsMkdir/FsEncoding/trailing_HT, … (10 more)

so it is maybe not surprising that it’s failing this one too. Seems like there is some larger issue there.

Note that linkbox has some overrides in the integration test config

https://github.com/rclone/rclone/blob/f4c058e13e3b0af3bed5c4e6db39599e5e440694/fstest/test_all/config.yaml#L376-L382

I’m not sure what is up with it though - I think there may be a PR in the queue.

The others are all failing in the same specific way as onedrive, so I predict they would be fixed by 365f539, although it remains entirely possible that I’m misunderstanding why the change fixes it (in which case, please correct me 😄)

That fix looks OK if we need it, but I think we probably won’t with DirMove.

Fixing the integration tests is an iterative process, I tend to fix one set of stuff a day until it is all clean!

Happy for you to merge fixes for integration tests when you are happy with them.

@ncw I tried operations.DirMove and it worked like a charm. Seems like a cleaner solution for multiple issues here. Thoughts? nielash@34c632e

Yes DirMove seems like a good idea. That was made for the vfs to rename directories and will use the underlying DirMove primitives if available so will be much more efficient.

It’s possible I’m misunderstanding something, but that really seems to be what’s happening as far as I can tell!

Got it - your explanation sounds correct to me.

Will reply to other queries above later!

Ok I think I figured it out. Branch with fixes: https://github.com/nielash/rclone/commits/fix-int-tests/

Three different issues, involving different remotes. (Btw, all 3 tests are new ones I added – not regressions.)

Great

TestFixCase

Proposed fix: nielash@a369fcb I think this actually revealed a pre-existing bug in rclone that was not previously covered by the tests. In a nutshell, operations.moveOrCopyFile had a special section to handle changing case of a file on a case insensitive remote, but operations.Move did not. The issue only affects backends that are incapable of renaming a file in-place to an equal-folding name, which is not all case-insensitive remotes. This is why I did not catch it when testing on macOS (which is case-insensitive but can rename in place.)

Yes I think you are right. Good fix 😃 I have merged that.

Note also that while testing, Dropbox sometimes complained about too_many_write_operations unless I slept for a second or two between moves (nielash@a85313c). This probably isn’t the right fix, and may not actually be needed (is it just a limitation of the free account I’m using? does the real integration test account have higher API limits?)

I haven’t merged that patch. The pacer should be retrying these and backing off I think - that is the best place to fix the problem I think. Dropbox is stingy with there iops and a lot of rclone users run with --tpslimit 12 which seems to be the right number for uploading lots of files - not sure about moves.

TestCaseInsensitiveMoveFileDryRun

nielash@a2dccf8

It appears that ci.DryRun = true affects the behavior of r.WriteObject on chunker only, and no other remotes. This change puts a quick bandaid on it by setting it later on in the test, but perhaps the underlying issue warrants a closer look at some point… is chunker checking ci.DryRun itself in a way that no other remote does? If so, should it? (Does this break encapsulation?)

OK, weird, but good enough for now! Merged.

TestApplyTransforms

I think this one is actually an issue with the 3 failing backends (Jottacloud, Koofr, and Owncloud) not the test or code. I suspect the issue is that these 3 are normalizing to NFC on the server side, so they are actually incapable of supporting NoUnicodeNormalization (i.e. if you give it NFD, it will convert it to NFC anyway). A quick search seems to confirm this (for example, see Owncloud issue 6338.) So, not sure what the right fix is here – perhaps we should just skip this test for these 3 backends, by name?

I prefer not to have backends named in the tests.

This can be done in two ways

  1. one is add an exception to the integration test config - the test will still fail but the integration tests will pass as this is an allowed failure.
  2. Add a Feature flag to the backend so we know which backends can’t support NoUnicodeNormalization.

I don’t think the Feature flag is useful except in the tests, so I’d probably go with 1. What do you think?

CI is passing for my branch with the fixes: https://github.com/nielash/rclone/actions/runs/7632382555

Thanks for fixing those @nielash . I pulled those locally gave them a test and I’ve merged them now and we can check the integration tests tomorrow to see how we did!

Yep, looking at it now.