Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: third_party/gsutil/third_party/boto/tests/unit/emr/test_instance_group_args.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/gsutil/third_party/boto/tests/unit/emr/test_instance_group_args.py
diff --git a/third_party/gsutil/third_party/boto/tests/unit/emr/test_instance_group_args.py b/third_party/gsutil/third_party/boto/tests/unit/emr/test_instance_group_args.py
new file mode 100755
index 0000000000000000000000000000000000000000..cc5c747bb7f28757b5f6de13410f973dd89d02b9
--- /dev/null
+++ b/third_party/gsutil/third_party/boto/tests/unit/emr/test_instance_group_args.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# Author: Charlie Schluting <charlie@schluting.com>
+#
+# Test to ensure initalization of InstanceGroup object emits appropriate errors
+# if bidprice is not specified, but allows float, int, Decimal.
+
+from decimal import Decimal
+
+from tests.compat import unittest
+from boto.emr.instance_group import InstanceGroup
+
+
+class TestInstanceGroupArgs(unittest.TestCase):
+
+ def test_bidprice_missing_spot(self):
+ """
+ Test InstanceGroup init raises ValueError when market==spot and
+ bidprice is not specified.
+ """
+ with self.assertRaisesRegexp(ValueError, 'bidprice must be specified'):
+ InstanceGroup(1, 'MASTER', 'm1.small',
+ 'SPOT', 'master')
+
+ def test_bidprice_missing_ondemand(self):
+ """
+ Test InstanceGroup init accepts a missing bidprice arg, when market is
+ ON_DEMAND.
+ """
+ instance_group = InstanceGroup(1, 'MASTER', 'm1.small',
+ 'ON_DEMAND', 'master')
+
+ def test_bidprice_Decimal(self):
+ """
+ Test InstanceGroup init works with bidprice type = Decimal.
+ """
+ instance_group = InstanceGroup(1, 'MASTER', 'm1.small',
+ 'SPOT', 'master', bidprice=Decimal(1.10))
+ self.assertEquals('1.10', instance_group.bidprice[:4])
+
+ def test_bidprice_float(self):
+ """
+ Test InstanceGroup init works with bidprice type = float.
+ """
+ instance_group = InstanceGroup(1, 'MASTER', 'm1.small',
+ 'SPOT', 'master', bidprice=1.1)
+ self.assertEquals('1.1', instance_group.bidprice)
+
+ def test_bidprice_string(self):
+ """
+ Test InstanceGroup init works with bidprice type = string.
+ """
+ instance_group = InstanceGroup(1, 'MASTER', 'm1.small',
+ 'SPOT', 'master', bidprice='1.1')
+ self.assertEquals('1.1', instance_group.bidprice)
+
+if __name__ == "__main__":
+ unittest.main()

Powered by Google App Engine
This is Rietveld 408576698