Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 33207c4

Browse files
authored
Merge pull request #362 from codecov/dana/after_n_builds_for_flags
add after_n_builds for flags
2 parents 4b845db + ab23797 commit 33207c4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

shared/validation/user_schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
"carryforward": {"type": "boolean"},
128128
"paths": path_list_structure,
129129
"ignore": path_list_structure,
130+
"after_n_builds": {"type": "integer", "min": 0},
130131
}
131132

132133
component_rule_basic_properties = {
@@ -391,6 +392,7 @@
391392
"type": ["boolean", "string", "dict"],
392393
"schema": {"branches": branches_structure},
393394
},
395+
"after_n_builds": {"type": "integer", "min": 0},
394396
},
395397
},
396398
},

tests/unit/validation/test_validation.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ def test_many_flags_validation(self):
307307
"carryforward": False,
308308
"statuses": [{"name_prefix": "aaa", "type": "patch"}],
309309
},
310-
"individual_flags": [{"name": "cawcaw", "paths": ["banana"]}],
310+
"individual_flags": [
311+
{"name": "cawcaw", "paths": ["banana"], "after_n_builds": 3}
312+
],
311313
},
312314
}
313315
expected_result = {
@@ -439,7 +441,9 @@ def test_many_flags_validation(self):
439441
"carryforward": False,
440442
"statuses": [{"name_prefix": "aaa", "type": "patch"}],
441443
},
442-
"individual_flags": [{"name": "cawcaw", "paths": ["^banana.*"]}],
444+
"individual_flags": [
445+
{"name": "cawcaw", "paths": ["^banana.*"], "after_n_builds": 3}
446+
],
443447
},
444448
}
445449
assert validate_yaml(user_input) == expected_result
@@ -1069,6 +1073,13 @@ def test_assume_flags():
10691073
) == {"flags": {"some_flag": {"assume": {"branches": ["^master$"]}}}}
10701074

10711075

1076+
def test_after_n_builds_flags():
1077+
user_input = {"flags": {"some_flag": {"after_n_builds": 5}}}
1078+
assert do_actual_validation(
1079+
user_input, show_secrets_for=("github", "11934774", "154468867")
1080+
) == {"flags": {"some_flag": {"after_n_builds": 5}}}
1081+
1082+
10721083
def test_profiling_schema():
10731084
user_input = {
10741085
"profiling": {

0 commit comments

Comments
 (0)