Skip to content

Commit

Permalink
Use legacy pool for prediction tests
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Aug 6, 2024
1 parent ba4d0ec commit 4491277
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ jobs:
matrix:
include:
- toolchain: 1.80.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
- toolchain: 1.71.1 # LOWEST SUPPORTED RUST TOOLCHAIN
legacy: LEGACY_POOL=../../target/debug/stratis-legacy-pool
- toolchain: 1.80.0 # CURRENT DEVELOPMENT RUST TOOLCHAIN
legacy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -239,12 +241,15 @@ jobs:
run: sudo cp stratisd.conf /usr/share/dbus-1/system.d
- name: Reload udev
run: sudo udevadm control --reload
- name: Build test extras
run: PROFILEDIR=debug make -f Makefile build-test-extras
- name: Tests using Rust ${{ matrix.toolchain }}
run: >
sudo make
RUST_LOG=stratisd=debug
STRATISD=/usr/libexec/stratisd
STRATIS_PREDICT_USAGE=/usr/bin/stratis-predict-usage
${{ matrix.legacy }}
PYTHONPATH=./src
predict-tests
working-directory: ./tests/client-dbus
6 changes: 6 additions & 0 deletions src/bin/utils/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ impl StratisPredictUsage {
.subcommands(vec![
Command::new("pool")
.about("Predicts the space usage when creating a Stratis pool.")
.arg(Arg::new("metadata-version")
.long("metadata-version")
.default_value("1")
.help("Stratis metadata version")
.value_parser(["1", "2"])
)
.arg(Arg::new("encrypted")
.long("encrypted")
.action(ArgAction::SetTrue)
Expand Down
3 changes: 3 additions & 0 deletions tests/client-dbus/tests/udev/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from stratisd_client_dbus._constants import TOP_OBJECT

from ._utils import (
_LEGACY_POOL,
OptionalKeyServiceContextManager,
ServiceContextManager,
UdevTest,
Expand All @@ -47,6 +48,7 @@
_STRATIS_PREDICT_USAGE = os.environ["STRATIS_PREDICT_USAGE"]
# Filesystem size limit should be no more than three times actual size
_FILESYSTEM_MULT_LIMIT = 3
_METADATA_VERSION = 2 if _LEGACY_POOL is None else 1


def _call_predict_usage(encrypted, device_sizes, *, fs_specs=None, overprovision=True):
Expand All @@ -62,6 +64,7 @@ def _call_predict_usage(encrypted, device_sizes, *, fs_specs=None, overprovision
"""
with subprocess.Popen(
[_STRATIS_PREDICT_USAGE, "pool"]
+ [f"--metadata-version={_METADATA_VERSION}"]
+ [f"--device-size={size}" for size in device_sizes]
+ (
[]
Expand Down

0 comments on commit 4491277

Please sign in to comment.