Skip to content

Commit

Permalink
fix sampling_rule default values
Browse files Browse the repository at this point in the history
  • Loading branch information
jj22ee committed Feb 6, 2024
1 parent 1cca2e5 commit 8dcaba7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ def __init__(
Version=None,
):
self.Attributes = Attributes if Attributes is not None else {}
self.FixedRate = FixedRate if FixedRate is not None else ""
self.FixedRate = FixedRate if FixedRate is not None else 0.0
self.HTTPMethod = HTTPMethod if HTTPMethod is not None else ""
self.Host = Host if Host is not None else ""
self.Priority = Priority if Priority is not None else ""
self.ReservoirSize = ReservoirSize if ReservoirSize is not None else ""
# Default to value with lower priority than default rule
self.Priority = Priority if Priority is not None else 10001
self.ReservoirSize = ReservoirSize if ReservoirSize is not None else 0
self.ResourceARN = ResourceARN if ResourceARN is not None else ""
self.RuleARN = RuleARN if RuleARN is not None else ""
self.RuleName = RuleName if RuleName is not None else ""
self.ServiceName = ServiceName if ServiceName is not None else ""
self.ServiceType = ServiceType if ServiceType is not None else ""
self.URLPath = URLPath if URLPath is not None else ""
self.Version = Version if Version is not None else ""
self.Version = Version if Version is not None else 0
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ def test_default_values_used_when_missing_properties_in_sampling_rule(self, mock

sampling_rule = sampling_rules[0]
self.assertEqual(sampling_rule.Attributes, {})
self.assertEqual(sampling_rule.FixedRate, "")
self.assertEqual(sampling_rule.FixedRate, 0.0)
self.assertEqual(sampling_rule.HTTPMethod, "")
self.assertEqual(sampling_rule.Host, "")
self.assertEqual(sampling_rule.Priority, "")
self.assertEqual(sampling_rule.ReservoirSize, "")
self.assertEqual(sampling_rule.Priority, 10001)
self.assertEqual(sampling_rule.ReservoirSize, 0)
self.assertEqual(sampling_rule.ResourceARN, "")
self.assertEqual(sampling_rule.RuleARN, "")
self.assertEqual(sampling_rule.RuleName, "")
self.assertEqual(sampling_rule.ServiceName, "")
self.assertEqual(sampling_rule.ServiceType, "")
self.assertEqual(sampling_rule.URLPath, "")
self.assertEqual(sampling_rule.Version, "")
self.assertEqual(sampling_rule.Version, 0)

@patch("requests.post")
def test_get_three_sampling_rules(self, mock_post=None):
Expand Down

0 comments on commit 8dcaba7

Please sign in to comment.