reduce parameters for func JoinOptionPriority

Signed-off-by: fanjiyun <fan.jiyun@zte.com.cn>
This commit is contained in:
fanjiyun 2020-05-15 11:02:30 +08:00
parent b1729e8588
commit a24e5f5fd4
3 changed files with 6 additions and 6 deletions

View file

@ -1055,7 +1055,7 @@ func CreateOptionLoadBalancer() EndpointOption {
// JoinOptionPriority function returns an option setter for priority option to
// be passed to the endpoint.Join() method.
func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
func JoinOptionPriority(prio int) EndpointOption {
return func(ep *endpoint) {
// ep lock already acquired
c := ep.network.getController()

View file

@ -51,7 +51,7 @@ fe90::2 somehost.example.com somehost
t.Fatal(err)
}
if err := ep1.Join(sbx, JoinOptionPriority(ep1, 1)); err != nil {
if err := ep1.Join(sbx, JoinOptionPriority(1)); err != nil {
t.Fatal(err)
}

View file

@ -110,15 +110,15 @@ func TestSandboxAddMultiPrio(t *testing.T) {
t.Fatal(err)
}
if err := ep1.Join(sbx, JoinOptionPriority(ep1, 1)); err != nil {
if err := ep1.Join(sbx, JoinOptionPriority(1)); err != nil {
t.Fatal(err)
}
if err := ep2.Join(sbx, JoinOptionPriority(ep2, 2)); err != nil {
if err := ep2.Join(sbx, JoinOptionPriority(2)); err != nil {
t.Fatal(err)
}
if err := ep3.Join(sbx, JoinOptionPriority(ep3, 3)); err != nil {
if err := ep3.Join(sbx, JoinOptionPriority(3)); err != nil {
t.Fatal(err)
}
@ -145,7 +145,7 @@ func TestSandboxAddMultiPrio(t *testing.T) {
}
// Re-add ep3 back
if err := ep3.Join(sbx, JoinOptionPriority(ep3, 3)); err != nil {
if err := ep3.Join(sbx, JoinOptionPriority(3)); err != nil {
t.Fatal(err)
}