Skip to content

Commit

Permalink
test: disk size is ok if less than 4 percent of expected
Browse files Browse the repository at this point in the history
QE reported a test failure like this:
```
TASK [Show actual size] ********************************************************
ok: [localhost] => {
    "storage_test_actual_size": {
        "bytes": 1649267441664,
        "changed": false,
        "failed": false,
        "lvm": "1t",
        "parted": "1TiB",
        "size": "1 TiB"
    }
}

TASK [Show expected size] ******************************************************
ok: [localhost] => {
    "storage_test_expected_size": "1600321314816"
}

TASK [Assert expected size is actual size] *************************************
fatal: [localhost]: FAILED! => {
    "assertion": "(storage_test_expected_size | int - storage_test_actual_size.bytes) | abs / storage_test_expected_size | int < 0.02",
    "changed": false,
    "evaluated_to": false,
    "msg": "Volume test1 has unexpected size (expected: 1600321314816 / actual: 1649267441664)"
}

PLAY RECAP *********************************************************************
```

In this case,
```
>>> abs(1600321314816-1649267441664)/1600321314816
0.03058518710889486
```
I think this is correct, so raising the percentage to check to 4.

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Jan 30, 2024
1 parent 2239777 commit cc7af32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test-verify-volume-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
- name: Assert expected size is actual size
assert:
that: (storage_test_expected_size | int - storage_test_actual_size.bytes) |
abs / storage_test_expected_size | int < 0.02
abs / storage_test_expected_size | int < 0.04
msg: >-
Volume {{ storage_test_volume.name }} has unexpected size
(expected: {{ storage_test_expected_size | int }} /
Expand Down

0 comments on commit cc7af32

Please sign in to comment.