* Add DB changes for host, set members, and host addresses for plugins. * Add priority, address review feedback, update tests, naming, protos Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com> Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
package plugin
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_GetOpts(t *testing.T) {
|
|
t.Parallel()
|
|
t.Run("WithName", func(t *testing.T) {
|
|
opts := getOpts(WithName("test"))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withName = "test"
|
|
assert.Equal(t, opts, testOpts)
|
|
})
|
|
t.Run("WithPluginId", func(t *testing.T) {
|
|
opts := getOpts(withPluginId("test"))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withPluginId = "test"
|
|
assert.Equal(t, opts, testOpts)
|
|
})
|
|
t.Run("WithDescription", func(t *testing.T) {
|
|
opts := getOpts(WithDescription("test desc"))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withDescription = "test desc"
|
|
assert.Equal(t, opts, testOpts)
|
|
})
|
|
t.Run("WithLimit", func(t *testing.T) {
|
|
opts := getOpts(WithLimit(5))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withLimit = 5
|
|
assert.Equal(t, opts, testOpts)
|
|
})
|
|
t.Run("WithPreferredEndpoints", func(t *testing.T) {
|
|
opts := getOpts(WithPreferredEndpoints([]string{"foo"}))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withPreferredEndpoints = []string{"foo"}
|
|
assert.EqualValues(t, opts, testOpts)
|
|
})
|
|
t.Run("withDnsNames", func(t *testing.T) {
|
|
opts := getOpts(withDnsNames([]string{"foo"}))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withDnsNames = []string{"foo"}
|
|
assert.EqualValues(t, opts, testOpts)
|
|
})
|
|
t.Run("withIpAddresses", func(t *testing.T) {
|
|
opts := getOpts(withIpAddresses([]string{"foo"}))
|
|
testOpts := getDefaultOptions()
|
|
testOpts.withIpAddresses = []string{"foo"}
|
|
assert.EqualValues(t, opts, testOpts)
|
|
})
|
|
}
|