@@ -61,7 +61,7 @@ type Node struct {
61
61
NodeTimeout time.Duration
62
62
SpecTimeout time.Duration
63
63
GracePeriod time.Duration
64
- AroundNodes AroundNodes
64
+ AroundNodes types. AroundNodes
65
65
66
66
NodeIDWhereCleanupWasGenerated uint
67
67
}
@@ -87,51 +87,24 @@ type FlakeAttempts uint
87
87
type MustPassRepeatedly uint
88
88
type Offset uint
89
89
type Done chan <- any // Deprecated Done Channel for asynchronous testing
90
- type Labels []string
91
- type SemVerConstraints []string
92
90
type PollProgressInterval time.Duration
93
91
type PollProgressAfter time.Duration
94
92
type NodeTimeout time.Duration
95
93
type SpecTimeout time.Duration
96
94
type GracePeriod time.Duration
97
95
98
- func BuildAroundNode (f AroundNodeFunc ) AroundNode {
99
- return AroundNode {
100
- Body : f ,
101
- CodeLocation : types .NewCodeLocation (1 ),
102
- }
103
- }
104
-
105
- type AroundNodeFunc func (ctx context.Context , body func (ctx context.Context ))
106
-
107
- type AroundNode struct {
108
- Body AroundNodeFunc
109
- CodeLocation types.CodeLocation
110
- }
111
-
112
- type AroundNodes []AroundNode
96
+ type Labels []string
113
97
114
98
func (l Labels ) MatchesLabelFilter (query string ) bool {
115
99
return types .MustParseLabelFilter (query )(l )
116
100
}
117
101
102
+ type SemVerConstraints []string
103
+
118
104
func (svc SemVerConstraints ) MatchesSemVerFilter (version string ) bool {
119
105
return types .MustParseSemVerFilter (version )(svc )
120
106
}
121
107
122
- func (an AroundNodes ) Clone () AroundNodes {
123
- out := make (AroundNodes , len (an ))
124
- copy (out , an )
125
- return out
126
- }
127
-
128
- func (an AroundNodes ) Append (other ... AroundNode ) AroundNodes {
129
- out := make (AroundNodes , len (an )+ len (other ))
130
- copy (out , an )
131
- copy (out [len (an ):], other )
132
- return out
133
- }
134
-
135
108
func unionOf [S ~ []E , E comparable ](slices ... S ) S {
136
109
out := S {}
137
110
seen := map [E ]bool {}
@@ -207,7 +180,7 @@ func isDecoration(arg any) bool {
207
180
return true
208
181
case t == reflect .TypeOf (GracePeriod (0 )):
209
182
return true
210
- case t == reflect .TypeOf (AroundNode {}):
183
+ case t == reflect .TypeOf (types. AroundNodeDecorator {}):
211
184
return true
212
185
case t .Kind () == reflect .Slice && isSliceOfDecorations (arg ):
213
186
return true
@@ -349,8 +322,8 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
349
322
if nodeType .Is (types .NodeTypeContainer ) {
350
323
appendError (types .GinkgoErrors .InvalidDecoratorForNodeType (node .CodeLocation , nodeType , "GracePeriod" ))
351
324
}
352
- case t == reflect .TypeOf (AroundNode {}):
353
- node .AroundNodes = append (node .AroundNodes , arg .(AroundNode ))
325
+ case t == reflect .TypeOf (types. AroundNodeDecorator {}):
326
+ node .AroundNodes = append (node .AroundNodes , arg .(types. AroundNodeDecorator ))
354
327
case t == reflect .TypeOf (Labels {}):
355
328
if ! nodeType .Is (types .NodeTypesForContainerAndIt ) {
356
329
appendError (types .GinkgoErrors .InvalidDecoratorForNodeType (node .CodeLocation , nodeType , "Label" ))
0 commit comments