Skip to content

Commit

Permalink
Add label to serial nodes
Browse files Browse the repository at this point in the history
Adding a label in order to be able to filter tests decorated with `Serial`.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
  • Loading branch information
akalenyu authored and onsi committed Nov 17, 2024
1 parent 38febf2 commit 0fcaa08
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration/timeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var _ = Describe("Timeline output", func() {

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

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

Ω(session).Should(gbytes.Say(retryDenoter + ` \[FLAKEY TEST - TOOK 3 ATTEMPTS TO PASS\]`))
Ω(session).Should(gbytes.Say(`a full timeline\n`))
Ω(session).Should(gbytes.Say(`a full timeline \[Serial\]\n`))
Ω(session).Should(gbytes.Say(`a flaky test\n`))
Ω(session).Should(gbytes.Say(`retries a few times\n`))
Ω(session).Should(gbytes.Say(`> Enter \[BeforeEach\] a flaky test`))
Expand Down
3 changes: 3 additions & 0 deletions internal/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
}
case t == reflect.TypeOf(Serial):
node.MarkedSerial = bool(arg.(serialType))
if !labelsSeen["Serial"] {
node.Labels = append(node.Labels, "Serial")
}
if !nodeType.Is(types.NodeTypesForContainerAndIt) {
appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "Serial"))
}
Expand Down
1 change: 1 addition & 0 deletions internal/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ var _ = Describe("Constructing nodes", func() {
It("marks the node as Serial", func() {
node, errors := internal.NewNode(dt, ntIt, "text", body, Serial)
Ω(node.MarkedSerial).Should(BeTrue())
Ω(node.Labels).Should(Equal(Labels{"Serial"}))
ExpectAllWell(errors)
})
It("allows containers to be marked", func() {
Expand Down

0 comments on commit 0fcaa08

Please sign in to comment.