No description
Find a file
2021-02-08 12:54:54 +01:00
cmd Relax constraint on arguments of zpool import mock 2019-11-15 12:43:10 +01:00
debian releasing package grubzfs-testsuite version 0.4.15 2021-02-08 12:54:54 +01:00
githooks githook: use variable to avoid repetition 2019-05-03 08:32:16 +02:00
testdata Update testdata following fixes of grub. 2021-02-08 11:02:55 +01:00
.gitignore Ignore vendor directory 2019-06-04 11:55:52 +02:00
disk_handler_test.go Allow to mount the same dataset several times. 2020-02-06 17:38:50 +01:00
go.mod Switch to upstream branch of go-libzfs with 2.0.x support. 2021-02-04 16:01:14 +00:00
go.sum Switch to upstream branch of go-libzfs with 2.0.x support. 2021-02-04 16:01:14 +00:00
grubmkconfig_test.go Fix intercall in prepare_grub_to_access_device_cached for new 10_linux_zfs 2020-03-31 17:34:04 +02:00
helpers_test.go Enable awk implementation selection for tests 2019-06-27 15:19:49 +02:00
LICENSE Initial commit 2019-04-19 08:36:52 +02:00
main_test.go Make TestGrubMkConfig wait on TestBootlist 2021-02-08 12:54:54 +01:00
ordering_test.go Relax a little bit timeouts and test syncing 2019-05-27 10:00:01 +02:00
README.md Added zsys to list of dependencies 2019-11-15 12:36:33 +01:00

grubzfs-testsuite

Integration tests for zfs (zsys/non zsys) grub menu generation (/etc/grub.d/10_linux_zfs)

Test dependencies

On Debian and derivatives, the following packages are required (grub and zfs):

  • grub-common
  • zfsutils-linux
  • libzfslinux-dev
  • e2fsprogs
  • zsys

Go 1.11 (minimum) is required.

Running the tests

As the tests are interacting with zfs kernel modules, the user should have zpool and zfs dataset creation permissions.

We are checking if user is root for tests dealing with zpool creation.

# go test

Alternatively, you can use a test binary (compiled by go test -c). The test binary will pick any datadir and mocks (or cmd/ see "Mock rebuild conditions") in the current directory. If it can't find them, it will pick them relative to the test binary directory itself.

Types of tests

There are 4 types of test:

  • TestBootlist: Test the generation of the intermediary bootlist file.
  • TestMetaMenu: Test the generation of the intermediary metamenu file from a bootlist.
  • TestGrubMenu: Test the generation of the finale grub configuration file from a metamenu.
  • TestGrubMkConfig: Run all the above coverage in one shot, without intermediary files.

Note that tests that don't deal with dataset creation can be executed in parallel.

Targeting a different 10_linux_zfs file

By default, the tests are using the installed version of 10_linux_zfs located in /etc/grub.d/. You can target a different file by passing its path to the command line option -linux-zfs=<path>.

If you have multiple tests to run, you can export GRUBTESTS_LINUXZFS=<path> to avoid setting the flag each for each test. It will take precedence over the command line argument.

Updating reference files

The first 3 types of test are using reference (golden) files and compare the generated output with those.

You can update the reference files with the -update command line argument. This argument will also refresh the reference files if they already exist.

The updated golden files should be committed to the VCS.

Slow mode options

As of ZFS 0.7, you can't create multiple times pools with the same names. There is a risk to create data locks. The -slow option seems to alleviate the issue by temporizing tests when creating/removing pools and datasets.

Dangerous mode

Some tests need to move utilities outside of the user's $PATH before restoring them. As we are tempering the system, those tests are skipped by default. The command line option -dangerous will run them.

Mock rebuild conditions

We are using mocks (sources are in the cmd/ directory) and rebuild them each time you run tests. If this directory isn't available, we assume there is a mocks subdirectory, with one subdirectory for each mocks. . This is mostly used when building a test binary while not shipping the source in a binary package.