Example #1
0
 def test_validate_bisect_config_with_missing_required_fails(self):
     with self.assertRaises(config_validation.ValidationFail):
         config_validation.validate_bisect_config(
             config={},
             schema={'foo': {
                 'type': 'integer',
                 'required': True
             }})
 def test_validate_metric_with_return_code_not_required(self):
   schema = {
       'metric': {'type': 'string'},
       'bisect_mode': {'type': 'string'},
   }
   config = {
       'bisect_mode': 'return_code',
   }
   config_validation.validate_bisect_config(config, schema)
Example #3
0
 def test_validate_metric_with_return_code_not_required(self):
   schema = {
       'metric': {'type': 'string'},
       'bisect_mode': {'type': 'string'},
   }
   config = {
       'bisect_mode': 'return_code',
   }
   config_validation.validate_bisect_config(config, schema)
 def test_validate_metric_missing_failure(self):
   schema = {
       'metric': {'type': 'string'},
       'bisect_mode': {'type': 'string'},
   }
   config = {
       'bisect_mode': 'mean',
   }
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_bisect_config(config, schema)
Example #5
0
 def test_validate_metric_missing_failure(self):
   schema = {
       'metric': {'type': 'string'},
       'bisect_mode': {'type': 'string'},
   }
   config = {
       'bisect_mode': 'mean',
   }
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_bisect_config(config, schema)
 def test_validate_metric_format_pass(self):
   schema = {
       'metric': {'type': 'string'},
       'bisect_mode': {'type': 'string'},
   }
   config = {
       'bisect_mode': 'mean',
       'metric': 'a/b',
   }
   config_validation.validate_bisect_config(config, schema)
Example #7
0
 def test_validate_metric_format_pass(self):
   schema = {
       'metric': {'type': 'string'},
       'bisect_mode': {'type': 'string'},
   }
   config = {
       'bisect_mode': 'mean',
       'metric': 'a/b',
   }
   config_validation.validate_bisect_config(config, schema)
 def test_validate_revisions_out_of_order_failure(self):
   schema = {
       'good_revision': {'type': 'revision'},
       'bad_revision': {'type': 'revision'},
   }
   config = {
       'good_revision': 200,
       'bad_revision': 100,
   }
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_bisect_config(config, schema)
Example #9
0
 def test_validate_revisions_out_of_order_failure(self):
   schema = {
       'good_revision': {'type': 'revision'},
       'bad_revision': {'type': 'revision'},
   }
   config = {
       'good_revision': 200,
       'bad_revision': 100,
   }
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_bisect_config(config, schema)
 def test_validate_bisect_config_larger_passing_example(self):
   schema = {
       'good_revision': {'type': 'revision'},
       'bad_revision': {'type': 'revision'},
       'str1': {'type': 'string'},
       'str2': {'type': 'string'},
       'int1': {'type': 'integer'},
       'int2': {'type': 'integer'},
       'bool1': {'type': 'boolean'},
       'bool2': {'type': 'boolean'},
   }
   config = {
       'good_revision': '0123456789abcdeabcde0123456789abcdeabcde',
       'bad_revision': 'bbbbbaaaaa0000011111bbbbbaaaaa0000011111',
       'str1': u'unicode-string',
       'str2': '',
       'int1': '12345',
       'int2': 12345,
       'bool1': True,
       'bool2': False,
   }
   config_validation.validate_bisect_config(config, schema)
Example #11
0
 def test_validate_bisect_config_larger_passing_example(self):
   schema = {
       'good_revision': {'type': 'revision'},
       'bad_revision': {'type': 'revision'},
       'str1': {'type': 'string'},
       'str2': {'type': 'string'},
       'int1': {'type': 'integer'},
       'int2': {'type': 'integer'},
       'bool1': {'type': 'boolean'},
       'bool2': {'type': 'boolean'},
   }
   config = {
       'good_revision': '0123456789abcdeabcde0123456789abcdeabcde',
       'bad_revision': 'bbbbbaaaaa0000011111bbbbbaaaaa0000011111',
       'str1': u'unicode-string',
       'str2': '',
       'int1': '12345',
       'int2': 12345,
       'bool1': True,
       'bool2': False,
   }
   config_validation.validate_bisect_config(config, schema)
Example #12
0
 def test_validate_bisect_config_empty_config(self):
   config_validation.validate_bisect_config(config={}, schema={})
 def test_validate_not_in_schema_passes(self):
   config_validation.validate_bisect_config(
       config={'foo': 'asdf'},
       schema={})
 def test_validate_optional_field_passes(self):
   config_validation.validate_bisect_config(
       config={},
       schema={'foo': {'type': 'integer'}})
 def test_validate_bisect_config_with_one_field_passes(self):
   config_validation.validate_bisect_config(
       config={'foo': 123},
       schema={'foo': {'type': 'integer'}})
 def test_validate_bisect_config_empty_config(self):
   config_validation.validate_bisect_config(config={}, schema={})
Example #17
0
 def test_validate_bisect_config_with_missing_required_fails(self):
   with self.assertRaises(config_validation.ValidationFail):
     config_validation.validate_bisect_config(
         config={},
         schema={'foo': {'type': 'integer', 'required': True}})
Example #18
0
 def test_validate_not_in_schema_passes(self):
   config_validation.validate_bisect_config(
       config={'foo': 'asdf'},
       schema={})
Example #19
0
 def test_validate_optional_field_passes(self):
   config_validation.validate_bisect_config(
       config={},
       schema={'foo': {'type': 'integer'}})
Example #20
0
 def test_validate_bisect_config_with_one_field_passes(self):
   config_validation.validate_bisect_config(
       config={'foo': 123},
       schema={'foo': {'type': 'integer'}})