In order to test Mayastor, you'll need to be able to run Mayastor, follow that guide for persistent hugepages & kernel module setup.
Or, for ad-hoc:
-
Ensure at least 512 2MB hugepages.
echo 512 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
-
Ensure several kernel modules are installed:
modprobe nbd xfs nvmet nvme_fabrics nvmet_rdma nvme_tcp nvme_rdma nvme_loop
Mayastor's unit tests, integration tests, and documentation tests via the conventional cargo test
.
An important note: Mayastor tests need to run on the host with
SYS_ADMIN
capabilities.You can see in
io-engine/.cargo/config
we override the test runner to execute as root, take this capability, then drop privileges.
Remember to enter the nix-shell before running any of the commands herein
Mayastor uses spdk which is quite sensitive to threading. This means tests need to run one at a time:
cd io-engine
RUST_LOG=TRACE cargo test -- --test-threads 1 --nocapture
To test your custom SPDK version please refere to the spdk-rs documentation
When developing new features, testing those with real PCIe devices in the process might come in handy. In order to do so, the PCIe device first needs to be bound to the vfio driver:
sudo PCI_ALLOWED="<PCI-ADDRESS>" ./spdk-rs/spdk/scripts/setup.sh
The bdev name in the cargo test case can then follow the PCIe URI pattern:
static BDEVNAME1: &str = "pcie:///<PCI-ADDRESS>";
After testing the device may be rebound to the NVMe driver:
sudo PCI_ALLOWED="<PCI-ADDRESS>" ./spdk-rs/spdk/scripts/setup.sh reset
Please do not submit pull requests with active cargo test cases that require PCIe devices to be present.
Mayastor does more complete, end-to-end testing. It requires some extra setup.
TODO: We're still writing this! Sorry! Let us know if you want us to prioritize this!
Running the gRPC mocha
test suite
There is a bit of extra setup to the mocha
tests, you need to set up the node modules.
To prepare:
cd test/grpc/
npm install
Then, to run the tests:
./node_modules/mocha/bin/mocha test_csi.js
TODO: We're still writing this! Sorry! Let us know if you want us to prioritize this!
There is a bit of extra setup to the gRPC tests, you need to set up the python venv.
To prepare:
./test/python/setup.sh
Then, to run the tests:
./scripts/pytest-tests.sh