-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scoring logic should live in the FlavorSpec and provide an easy way to obtain score for a given Machine. This reduces Matcher functionality to simply interacting with a collection of flavors and matching them against Machine.
- Loading branch information
Showing
5 changed files
with
229 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
python/ironic-understack/ironic_understack/tests/test_machine.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from ironic_understack.machine import Machine | ||
|
||
def test_memory_gb_property(): | ||
# Test a machine with exactly 1 GB of memory | ||
machine = Machine(memory_mb=1024, cpu="x86", disk_gb=50) | ||
assert machine.memory_gb == 1 | ||
|
||
# Test a machine with 2 GB of memory | ||
machine = Machine(memory_mb=2048, cpu="x86", disk_gb=50) | ||
assert machine.memory_gb == 2 | ||
|
||
# Test a machine with non-exact GB memory (should floor the value) | ||
machine = Machine(memory_mb=3072, cpu="x86", disk_gb=50) | ||
assert machine.memory_gb == 3 | ||
|
||
# Test a machine with less than 1 GB of memory | ||
machine = Machine(memory_mb=512, cpu="x86", disk_gb=50) | ||
assert machine.memory_gb == 0 |
Oops, something went wrong.