Skip to content

Commit 0fcaa08

Browse files
akalenyuonsi
authored andcommittedNov 17, 2024·
Add label to serial nodes
Adding a label in order to be able to filter tests decorated with `Serial`. Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
1 parent 38febf2 commit 0fcaa08

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed
 

‎integration/timeline_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ var _ = Describe("Timeline output", func() {
138138

139139
Ω(session).Should(gbytes.Say(`3 specs`))
140140

141-
Ω(session).Should(gbytes.Say(`a full timeline\n`))
141+
Ω(session).Should(gbytes.Say(`a full timeline \[Serial\]\n`))
142142
Ω(session).Should(gbytes.Say(`a flaky test\n`))
143143
Ω(session).Should(gbytes.Say(`retries a few times\n`))
144144
Ω(session).Should(gbytes.Say(`> Enter \[BeforeEach\] a flaky test`))
@@ -270,7 +270,7 @@ var _ = Describe("Timeline output", func() {
270270
Ω(session).Should(gbytes.Say(`3 specs`))
271271

272272
Ω(session).Should(gbytes.Say(retryDenoter + ` \[FLAKEY TEST - TOOK 3 ATTEMPTS TO PASS\]`))
273-
Ω(session).Should(gbytes.Say(`a full timeline\n`))
273+
Ω(session).Should(gbytes.Say(`a full timeline \[Serial\]\n`))
274274
Ω(session).Should(gbytes.Say(`a flaky test\n`))
275275
Ω(session).Should(gbytes.Say(`retries a few times\n`))
276276
Ω(session).Should(gbytes.Say(`> Enter \[BeforeEach\] a flaky test`))

‎internal/node.go

+3
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
241241
}
242242
case t == reflect.TypeOf(Serial):
243243
node.MarkedSerial = bool(arg.(serialType))
244+
if !labelsSeen["Serial"] {
245+
node.Labels = append(node.Labels, "Serial")
246+
}
244247
if !nodeType.Is(types.NodeTypesForContainerAndIt) {
245248
appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "Serial"))
246249
}

‎internal/node_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ var _ = Describe("Constructing nodes", func() {
269269
It("marks the node as Serial", func() {
270270
node, errors := internal.NewNode(dt, ntIt, "text", body, Serial)
271271
Ω(node.MarkedSerial).Should(BeTrue())
272+
Ω(node.Labels).Should(Equal(Labels{"Serial"}))
272273
ExpectAllWell(errors)
273274
})
274275
It("allows containers to be marked", func() {

0 commit comments

Comments
 (0)
Please sign in to comment.