Skip to content

Commit b30d4f1

Browse files
committed
Adds deeply nested tests
1 parent 5dd6e78 commit b30d4f1

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

tools/flakeguard/runner/example_test_package/example_tests_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,23 @@ func TestFailInParentBeforeSubTests(t *testing.T) {
102102
})
103103
}
104104

105+
func TestDeeplyNestedSubTests(t *testing.T) {
106+
t.Parallel()
107+
108+
t.Run("Level1", func(t *testing.T) {
109+
t.Run("Level2", func(t *testing.T) {
110+
t.Run("Level3", func(t *testing.T) {
111+
t.Run("Pass", func(t *testing.T) {
112+
t.Log("This deeply nested subtest always passes")
113+
})
114+
t.Run("Fail", func(t *testing.T) {
115+
t.Fatal("This deeply nested subtest always fails")
116+
})
117+
})
118+
})
119+
})
120+
}
121+
105122
// This test should have a 50% pass ratio
106123
func TestFlaky(t *testing.T) {
107124
t.Parallel()

tools/flakeguard/runner/runner_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,30 @@ func TestRun(t *testing.T) {
155155
exactRuns: &defaultTestRunCount,
156156
allFailures: true,
157157
},
158+
"TestDeeplyNestedSubTests": {
159+
exactRuns: &defaultTestRunCount,
160+
allFailures: true,
161+
},
162+
"TestDeeplyNestedSubTests/Level1": {
163+
exactRuns: &defaultTestRunCount,
164+
allFailures: true,
165+
},
166+
"TestDeeplyNestedSubTests/Level1/Level2": {
167+
exactRuns: &defaultTestRunCount,
168+
allFailures: true,
169+
},
170+
"TestDeeplyNestedSubTests/Level1/Level2/Level3": {
171+
exactRuns: &defaultTestRunCount,
172+
allFailures: true,
173+
},
174+
"TestDeeplyNestedSubTests/Level1/Level2/Level3/Pass": {
175+
exactRuns: &defaultTestRunCount,
176+
allSuccesses: true,
177+
},
178+
"TestDeeplyNestedSubTests/Level1/Level2/Level3/Fail": {
179+
exactRuns: &defaultTestRunCount,
180+
allFailures: true,
181+
},
158182
},
159183
},
160184
{

0 commit comments

Comments
 (0)