-
Notifications
You must be signed in to change notification settings - Fork 929
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(proto): fix getting attributes issue (#1968)
RPCInvocation::GetAttributeWithDefaultValue() has a typo which couldn't get attributes correctly, this PR fixes that issue. Signed-off-by: Xuewei Niu <justxuewei@apache.org>
- Loading branch information
1 parent
7b99da6
commit 08af2cc
Showing
6 changed files
with
338 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package polaris | ||
|
||
import ( | ||
"dubbo.apache.org/dubbo-go/v3/remoting" | ||
"github.com/polarismesh/polaris-go/api" | ||
"github.com/polarismesh/polaris-go/pkg/model" | ||
"github.com/stretchr/testify/assert" | ||
"sync" | ||
"testing" | ||
) | ||
|
||
func TestPolarisServiceWatcher_AddSubscriber(t *testing.T) { | ||
type fields struct { | ||
consumer api.ConsumerAPI | ||
subscribeParam *api.WatchServiceRequest | ||
lock *sync.RWMutex | ||
subscribers []subscriber | ||
execOnce *sync.Once | ||
} | ||
type args struct { | ||
subscriber func(remoting.EventType, []model.Instance) | ||
} | ||
var tests []struct { | ||
name string | ||
fields fields | ||
args args | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
watcher := &PolarisServiceWatcher{ | ||
subscribeParam: &newParam, | ||
consumer: newConsumer, | ||
lock: &sync.RWMutex{}, | ||
subscribers: make([]subscriber, 0), | ||
execOnce: &sync.Once{}, | ||
} | ||
assert.Empty(t, watcher) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package polaris | ||
|
||
import ( | ||
"dubbo.apache.org/dubbo-go/v3/common" | ||
"github.com/polarismesh/polaris-go/api" | ||
"reflect" | ||
"sync" | ||
"testing" | ||
) | ||
|
||
func Test_createDeregisterParam(t *testing.T) { | ||
type args struct { | ||
url *common.URL | ||
serviceName string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want *api.InstanceDeRegisterRequest | ||
}{ | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := createDeregisterParam(tt.args.url, tt.args.serviceName); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("createDeregisterParam() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func Test_polarisRegistry_Destroy(t *testing.T) { | ||
type fields struct { | ||
url *common.URL | ||
provider api.ProviderAPI | ||
lock *sync.RWMutex | ||
registryUrls map[string]*PolarisHeartbeat | ||
listenerLock *sync.RWMutex | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
}{ | ||
{ | ||
name: "Test_polarisRegistry_Destroy", | ||
fields: fields{ | ||
url: nil, | ||
provider: nil, | ||
registryUrls: nil, | ||
}, | ||
}, | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
}) | ||
} | ||
} |
Oops, something went wrong.