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

Commit

Permalink
Tests for scaleset size validation (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshuman-goel authored Nov 3, 2020
1 parent 4ef489b commit 46064fb
Showing 1 changed file with 34 additions and 1 deletion.
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()

0 comments on commit 46064fb

Please sign in to comment.