Skip to content

Commit

Permalink
Merge pull request #362 from codecov/dana/after_n_builds_for_flags
Browse files Browse the repository at this point in the history
add after_n_builds for flags
  • Loading branch information
dana-yaish authored Mar 15, 2023
2 parents 4b845db + ab23797 commit 33207c4
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions shared/validation/user_schema.py
Original file line number Diff line number Diff line change
@@ -127,6 +127,7 @@
"carryforward": {"type": "boolean"},
"paths": path_list_structure,
"ignore": path_list_structure,
"after_n_builds": {"type": "integer", "min": 0},
}

component_rule_basic_properties = {
@@ -391,6 +392,7 @@
"type": ["boolean", "string", "dict"],
"schema": {"branches": branches_structure},
},
"after_n_builds": {"type": "integer", "min": 0},
},
},
},
15 changes: 13 additions & 2 deletions tests/unit/validation/test_validation.py
Original file line number Diff line number Diff line change
@@ -307,7 +307,9 @@ def test_many_flags_validation(self):
"carryforward": False,
"statuses": [{"name_prefix": "aaa", "type": "patch"}],
},
"individual_flags": [{"name": "cawcaw", "paths": ["banana"]}],
"individual_flags": [
{"name": "cawcaw", "paths": ["banana"], "after_n_builds": 3}
],
},
}
expected_result = {
@@ -439,7 +441,9 @@ def test_many_flags_validation(self):
"carryforward": False,
"statuses": [{"name_prefix": "aaa", "type": "patch"}],
},
"individual_flags": [{"name": "cawcaw", "paths": ["^banana.*"]}],
"individual_flags": [
{"name": "cawcaw", "paths": ["^banana.*"], "after_n_builds": 3}
],
},
}
assert validate_yaml(user_input) == expected_result
@@ -1069,6 +1073,13 @@ def test_assume_flags():
) == {"flags": {"some_flag": {"assume": {"branches": ["^master$"]}}}}


def test_after_n_builds_flags():
user_input = {"flags": {"some_flag": {"after_n_builds": 5}}}
assert do_actual_validation(
user_input, show_secrets_for=("github", "11934774", "154468867")
) == {"flags": {"some_flag": {"after_n_builds": 5}}}


def test_profiling_schema():
user_input = {
"profiling": {

0 comments on commit 33207c4

Please sign in to comment.