1 parent
1fb960575f
commit
beb97ac9f2
9 files changed
+70
-36
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"net"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
serverpb "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
|
||||
@@ -26,4 +29,17 @@ func Test_GetOpts(t *testing.T) {
|
||||
testOpts.WithInjectedApplicationCredentials = []*serverpb.Credential{c}
|
||||
assert.Equal(opts, testOpts)
|
||||
})
|
||||
|
||||
t.Run("WithPostConnectionHook", func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
testFn := func(net.Conn) {}
|
||||
opts := GetOpts(WithPostConnectionHook(testFn))
|
||||
testOpts := getDefaultOptions()
|
||||
assert.NotEqual(opts, testOpts)
|
||||
testOpts.WithPostConnectionHook = testFn
|
||||
assert.Equal(
|
||||
runtime.FuncForPC(reflect.ValueOf(opts.WithPostConnectionHook).Pointer()).Name(),
|
||||
runtime.FuncForPC(reflect.ValueOf(testOpts.WithPostConnectionHook).Pointer()).Name(),
|
||||
)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user