DevHeads.net

Is it possible to mock an external drive (for unit testing)?

Hi!

Is it? How?

Do examples exist?

Thanks in advance,

Michael

Comments

Re: Is it possible to mock an external drive (for unit testing)?

By Albert Astals Cid at 03/11/2018 - 17:39

El dissabte, 10 de març de 2018, a les 18:27:51 CET, Michael Heidelbach va
escriure:
You'll really need to be more specific, my initial answer would be, why would
you care if something is a external drive?

Cheers,
Albert

Re: Is it possible to mock an external drive (for unit testing)?

By Michael Heidelbach at 03/12/2018 - 04:27

Albert ,

I've been unspecific deliberately. Apparently too much, sorry.

This is what I want to do:

To identify a document baloo is using a combination of device id and
inode. This is insufficient because at least on my system the device id
is not constant. For external drives it changes with the order in which
they are plugged in. There are also other reasons why baloo has to be
more aware of file systems.

I want to make baloo's document identification mechanism more reliable
and to be able to identify a drive unambiguously. For testing I'd like
to have something better than plugging pendrives in and out, some mock
drives with data to index would be optimal.

I'm currently figuring out the options how to tackle this. So there is
are specific questions yet.

Cheers,

Michael

On 11.03.2018 23:39, Albert Astals Cid wrote:

Re: Is it possible to mock an external drive (for unit testing)?

By Roman Chistokhodov at 03/13/2018 - 08:06

I'm not sure how you're gonna to make identification more reliable, but you
can use fuse to create mountpoints in user space. E.g. using archievemount
you can mount some archive and the files in the mountpoint will have
another device id. Fuse must be available on the target OS of course.

On Mon, Mar 12, 2018 at 12:27 PM, Michael Heidelbach < ... at gmail dot com>
wrote:

Re: Is it possible to mock an external drive (for unit testing)?

By Michael Heidelbach at 03/13/2018 - 09:38

Thanks for your reply, Roman
I also thought of archivemount but (maybe to early) discarded that idea
because for testing I need control over the device id.
I'm not sure how to make identification more reliable either. If I'm
able to read the uuid of a drive or partition it would be small enough
to incorporate into the document id directly. Otherwise I will have to
do some heuristics and use an extra db for device id/drive mapping. I
really don't know yet.
Cheers,
Michael

I'm not sure how you're gonna to make identification more reliable, but
you can use fuse to create mountpoints in user space. E.g. using
archievemount you can mount
On 13.03.2018 14:06, Roman Chistokhodov wrote:

Re: Is it possible to mock an external drive (for unit testing)?

By =?utf-8?q?Stefa... at 03/13/2018 - 11:37

On Dienstag, 13. März 2018 15:38:54 CET Michael Heidelbach wrote:
How about using one db per partition? This has several benefits:
- you free up space for 64 bit inodes (currently 32bit inode || 32 bit device)
- UUIDs are large in general (128 bit), adding this to the document id means
considerably larger keys to compare.
- the db becomes movable, i.e. saved on external drives
- as a consequence, the db can also be saved inside a vault

The partition UUID could be saved inside the db, but IMHO this would be an
optional safety measure only.

Kind regards,

Stefan

Re: Is it possible to mock an external drive (for unit testing)?

By Michael Heidelbach at 03/14/2018 - 06:54

On 13.03.2018 17:37, Brüns, Stefan wrote:
It's very intriguing, I'll give it some time to sink in.

Cheers,

Michael