Skip to content

Commit

Permalink
Change the key of a mock EchoFilter (#1381)
Browse files Browse the repository at this point in the history
* build(deps): bump actions/cache from v2.1.4 to v2.1.5

Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.4...1a9e213)

Signed-off-by: dependabot[bot] <[email protected]>

* improve etcd version and change create to put (#1203)

* change the mock filter key

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xin.Zh <[email protected]>
Co-authored-by: AlexStocks <[email protected]>
Co-authored-by: randy <[email protected]>
  • Loading branch information
5 people committed Aug 18, 2021
1 parent 77a8b5f commit 3c55f4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Thanks for sending a pull request!
Read https://github.com/apache/dubbo-go/blob/master/contributing.md before commit pull request.
Read https://github.com/apache/dubbo-go/blob/master/CONTRIBUTING.md before commit pull request.
-->

**What this PR does**:
Expand Down
10 changes: 6 additions & 4 deletions protocol/protocolwrapper/protocol_filter_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol"
)

const mockFilterKey = "mockEcho"

func TestProtocolFilterWrapperExport(t *testing.T) {
filtProto := extension.GetProtocol(FILTER)
filtProto.(*ProtocolFilterWrapper).protocol = &protocol.BaseProtocol{}

u := common.NewURLWithOptions(
common.WithParams(url.Values{}),
common.WithParamsValue(constant.SERVICE_FILTER_KEY, "echo "))
common.WithParamsValue(constant.SERVICE_FILTER_KEY, mockFilterKey))
exporter := filtProto.Export(protocol.NewBaseInvoker(u))
_, ok := exporter.GetInvoker().(*FilterInvoker)
assert.True(t, ok)
Expand All @@ -54,15 +56,15 @@ func TestProtocolFilterWrapperRefer(t *testing.T) {

u := common.NewURLWithOptions(
common.WithParams(url.Values{}),
common.WithParamsValue(constant.REFERENCE_FILTER_KEY, " echo"))
common.WithParamsValue(constant.REFERENCE_FILTER_KEY, mockFilterKey))
invoker := filtProto.Refer(u)
_, ok := invoker.(*FilterInvoker)
assert.True(t, ok)
}

// the same as echo filter, for test
// The initialization of mockEchoFilter, for test
func init() {
extension.SetFilter("echo", newFilter)
extension.SetFilter(mockFilterKey, newFilter)
}

type mockEchoFilter struct{}
Expand Down

0 comments on commit 3c55f4e

Please sign in to comment.