Add options for directly connected worker (#2762)

pull/2735/head^2
Irena Rindos 3 years ago committed by GitHub
parent ef6f94f496
commit b7f0f455db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,6 +47,7 @@ type options struct {
withOperationalState string
withActiveWorkers bool
withFeature version.Feature
withDirectlyConnected bool
}
func getDefaultOptions() options {
@ -230,3 +231,10 @@ func WithFeature(feature version.Feature) Option {
o.withFeature = feature
}
}
// WithDirectlyConnected provides an option to limit graph search to only directly connected workers
func WithDirectlyConnected(conn bool) Option {
return func(o *options) {
o.withDirectlyConnected = conn
}
}

@ -217,4 +217,12 @@ func Test_GetOpts(t *testing.T) {
testOpts.withNewIdFunc = nil
assert.Equal(t, opts, testOpts)
})
t.Run("WithDirectlyConnected", func(t *testing.T) {
opts := GetOpts(WithDirectlyConnected(true))
testOpts := getDefaultOptions()
testOpts.withDirectlyConnected = true
opts.withNewIdFunc = nil
testOpts.withNewIdFunc = nil
assert.Equal(t, opts, testOpts)
})
}

Loading…
Cancel
Save