backintime icon indicating copy to clipboard operation
backintime copied to clipboard

Test Mount API

Open daviewales opened this issue 9 months ago • 10 comments

WIP branch adding tests to Mount API for various backends.

daviewales avatar Feb 17 '25 06:02 daviewales

Great. I am most of the days offline until next week. But i am on it

buhtz avatar Feb 17 '25 12:02 buhtz

Note that it's still WIP. I've added high-level tests for the 'local' backend, as it's the simplest. I'll work on adding tests for the remaining backends.

daviewales avatar Feb 18 '25 00:02 daviewales

  • I updated the branch to the latest dev.
  • I kind of recreated the new encode.py file so that its git history (from encfstools.py) is preserved. Because of a Microsoft GitHub bug you wont see this history at GitHub. But in your local branch you should see its history back to year 2012/13 with git log --follow encode.py (the --follow is important!).
  • Add encode.py to the list of files that will be checked for all linter rules.
  • Some minor adjustments.

I really like your tests. I can read and understand them very well. This is high quality. I will dive a bit deeper. But for today I am finished. So you can work on your branch if you want to. I'll be back later.

buhtz avatar Apr 25 '25 18:04 buhtz

I don't understand the purpose of MountWithLocalEncFS.test_unconfigured_mount(). What is the difference between "unconfigured" and "configured" in context of EncFS?

buhtz avatar Apr 26 '25 13:04 buhtz

Unconfigured corresponds to the first run, before the BiT configuration or the EncFS directory is initialised.

Configured corresponds to later runs, where there is a preexisting configuration and EncFS directory.

daviewales avatar Apr 26 '25 22:04 daviewales

Unconfigured corresponds to the first run, before the BiT configuration or the EncFS directory is initialised.

Configured corresponds to later runs, where there is a preexisting configuration and EncFS directory.

There is this out-commented line in test_mount.py

# unconfigured_mount = mount.Mount(cfg=cfg, tmp_mount=True)

To my unerstanding cfg here is configured for local-encfs. So how can it be unconfigured. I still don't get it, sorry.

I don't know that the desired test result could be for test_unconfigured_mount(). But I also don't understand all the mount behavior of BIT. Have not touched that part of the code base ever.

If you can be more specific with your questions and needs I might be able to help.

buhtz avatar Apr 27 '25 15:04 buhtz

I've had a chance to look at this. 'Unconfigured' in this case refers to the EncFS configuration, rather than the BackInTime configuration. Yes, the BackInTime configuration is reused, but the EncFS mount has not yet been created. Perhaps I should rename it to test_uninitialised_mount()?

Edit:

Specifically, an initialised backup location will contain the file .encfs6.xml, while an uninitialised backup location will not.

daviewales avatar May 13 '25 04:05 daviewales

"uninitialized" sounds good to me.

buhtz avatar May 13 '25 05:05 buhtz

Hello David, Can you please give me a short update about this PR? Regards, Christian

buhtz avatar Jun 07 '25 17:06 buhtz

I haven't had much chance to work on the lately. The latest commit is work in progress, as the test I'm adding still needs some work to make it pass. In theory, it is supposed to create a new EncFS mount, and confirm that it was created.

daviewales avatar Jun 07 '25 21:06 daviewales

Hello David, in the last days, I was quit active with refactoring. Have not done this if I had knew that you are working currently.

I am finished now and hope I have not interfered your work to much with conflicts.

Best, Christian

buhtz avatar Jul 10 '25 12:07 buhtz

Don't worry about me! Conflicts are expected with a slow moving branch like this. (And there weren't many.)

daviewales avatar Jul 11 '25 11:07 daviewales

I'm getting a R1732 lint warning when creating a temporary directory, but I can't seem to disable the warning with noqa.

daviewales avatar Jul 14 '25 06:07 daviewales

Which linter? If pylint use "#pylint: disable=R1732"

Or follow the error and use "with"

Sorry. I am at holiday just using a touch device

buhtz avatar Jul 14 '25 19:07 buhtz

Hello David, when the scheduling of my other (non BIT) tasks works as expected I would be kind of "free" in December. If you have no objections against it by then I would take over this PR (and #1897) about locale GoCrypt support.

Would this be OK for you?

It would help me a lot if you could somehow summarize what you have done so far. The thing is I never used EncFS (or GoCrypt). I am also not familiar with the mounting part of the code base. I never touched that part of BIT.

What do you think?

Regards, Christian

PS: My idea is to have a first release candidate (1.6.0-rc1) offering local gocrypt support.

buhtz avatar Oct 29 '25 13:10 buhtz

I'm happy for you to take this over if you get time.

Please feel free to ask any questions you have.

In summary, this branch is trying to add high level tests for EncFS. From memory, it currently tests basic local mount and unmount. It's tricky to test, because there are a few places where the EncFS mount control code triggers UI code, rather than cleanly separating the two. I've tried to mock these out, rather than rewriting the EncFS code, as I'm worried to do that without first having tests.

The other branch (#1897) is a rebase of an old branch by Germar which works for gocryptfs, but breaks EncFS. It makes a significant change to the parent MountControl class, which makes it incompatible with the existing implementation of EncFS. The change is that it separates initialisation from mounting, whereas the current EncFS code combines them, and adds initialisation within the mount code if necessary.

Previously, I wanted to update the existing EncFS code to work with this new MountControl parent class. However, I now wonder of it would be easier and safer just to adapt the gocryptfs code to work with the old MountControl parent class, as this would eliminate the need to modify EncFS code.

I found that there are a lot of complex interactions between GUI, cinfig, and mount code, which made it tedious to test manually, and easy to introduce regressions. Hence why I started this testing branch.

daviewales avatar Oct 31 '25 11:10 daviewales