Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Tests for scaleset size validation #243

Merged
merged 8 commits into from
Nov 3, 2020
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/pytypes/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pydantic import ValidationError

from onefuzztypes.models import TeamsTemplate
from onefuzztypes.models import Scaleset, TeamsTemplate
from onefuzztypes.requests import NotificationCreate


Expand All @@ -28,5 +28,38 @@ def test_model(self) -> None:
NotificationCreate.parse_obj(missing_container)


class TestScaleset(unittest.TestCase):
def test_scaleset_size(self) -> None:
with self.assertRaises(ValueError):
Scaleset(
pool_name="test_pool",
vm_sku="Standard_D2ds_v4",
image="Canonical:UbuntuServer:18.04-LTS:latest",
region="westus2",
size=-1,
spot_instances=False,
)

scaleset = Scaleset(
pool_name="test_pool",
vm_sku="Standard_D2ds_v4",
image="Canonical:UbuntuServer:18.04-LTS:latest",
region="westus2",
size=0,
spot_instances=False,
)
self.assertEqual(scaleset.size, 0)

scaleset = Scaleset(
pool_name="test_pool",
vm_sku="Standard_D2ds_v4",
image="Canonical:UbuntuServer:18.04-LTS:latest",
region="westus2",
size=80,
spot_instances=False,
)
self.assertEqual(scaleset.size, 80)


if __name__ == "__main__":
unittest.main()