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 committed Nov 17, 2024
1 parent 38febf2 commit 578e3f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 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`))

Check failure on line 141 in integration/timeline_test.go

View workflow job for this annotation

GitHub Actions / Go oldstable

It 11/17/24 13:31:02.105

Check failure on line 141 in integration/timeline_test.go

View workflow job for this annotation

GitHub Actions / Go stable

It 11/17/24 13:32:19.545
Ω(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 578e3f4

Please sign in to comment.