FIXME: explain what PlentyFS is at a very high level, and what the motivation is
FIXME: explain the high level requirements as bullet points, not as scenarios
This chapter covers the detailed acceptance criteria for PlentyFS and how they are verified in an automated manner.
This scenario verifies that PlentyFS works at all. We expect the root of PlentyFS to contain 10,000 ordinary files and a directory called .plentyfs.
given a PlentyFS mounted at mnt
then there are 10001 files under mnt
when user runs PlentyFS without arguments
then exit code is 1
then stdout is empty
then stderr is exactly "Error: no mountpoint specified.\n"
when user runs PlentyFS with arguments -o tunable=disabled mnt
then exit code is 1
then stdout is empty
then stderr is exactly "Error: parameter `tunable' is not supported.\n"
PlentyFS generates data at random, but it's a program, so it can't conjure true randomness out of ether. Instead, it asks the operating system for a random number, and generates the data from that. This initial random number is called a "seed".
Some users might not want for the seed to be random. They might want to get the same PlentyFS contents as they got some previous time. This could be useful when reproducing bugs, or when writing tests — tasks that require a reproducible environment.
To enable that, PlentyFS lets the user to optionally pass a seed as a mount option.
given a PlentyFS mounted at mnt with options seed=b1a914b7e0d996a8
then there are a file at mnt/1 that starts with 0x7da14ac962299c89
then there are a file at mnt/2 that starts with 0x2f016e5b70122476
then there are a file at mnt/3 that starts with 0xd8ab69b279bf68e2
then there are a file at mnt/5 that starts with 0xae6efee6824678c2
There are a couple different ways in which the seed could be empty:
-
the user could type just the name of the parameter:
when user runs PlentyFS with arguments -o seed mnt then exit code is 1 then stdout is empty then stderr is exactly "Error: parameter `seed' requires a value.\n"
-
the user could type the name of the parameter and the
=
delimiter, but no actual value:when user runs PlentyFS with arguments -o seed= mnt then exit code is 1 then stdout is empty then stderr is exactly "Error: parameter `seed' requires a value.\n"
when user runs PlentyFS with arguments -o seed=abba0110f00dba7abba0202 mnt
then exit code is 1
then stdout is empty
then stderr is exactly "Error: value `abba0110f00dba7abba0202' is too long for parameter `seed'; maximum allowed length is 16 characters.\n"
when user runs PlentyFS with arguments -o seed=random mnt
then exit code is 1
then stdout is empty
then stderr is exactly "Error: value `random' for parameter `seed' is not a hexadecimal number.\n"
As described in the previous section, the contents of a mounted PlentyFS filesystem are derived from a single 64-bit number, called "seed". If the user doesn't provide it, PlentyFS asks the operating system to generate one. But what if the user finds the resulting filesystem so interesting that they want to re-create it later? To facilitate that use-case, PlentyFS provides its current seed via a file called .plentyfs/seed.
given a PlentyFS mounted at mnt
then file mnt/.plentyfs/seed is not empty
given a PlentyFS mounted at mnt with options seed=2490d7f7528f40b7
then file mnt/.plentyfs/seed contains "2490d7f7528f40b7"
title: PlentyFS - read-only, on-demand file system author: Alexander Batischev bindings:
- subplot/plentyfs.yaml
- lib/files.yaml
- lib/runcmd.yaml template: python functions:
- subplot/plentyfs.py
- lib/daemon.py
- lib/files.py
- lib/runcmd.py ...