This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 66e369fc feat: token filter & config merge integrate test (#552)
66e369fc is described below
commit 66e369fc7adbf798dd1360f3946a168b62be4f96
Author: ZLBer <[email protected]>
AuthorDate: Tue Apr 4 07:41:46 2023 +0800
feat: token filter & config merge integrate test (#552)
* feat: token filter integrate test
* feat: config merge integrate test
---
.../config-merge/tests/integration/main_test.go | 41 ++++++++++++++++++++++
.../config-merge/tests/integration/merge_test.go | 41 ++++++++++++++++++++++
.../filter/token/tests/integration/main_test.go | 41 ++++++++++++++++++++++
.../filter/token/tests/integration/token_test.go | 41 ++++++++++++++++++++++
start_integrate_test.sh | 2 ++
5 files changed, 166 insertions(+)
diff --git
a/integrate_test/config-api/config-merge/tests/integration/main_test.go
b/integrate_test/config-api/config-merge/tests/integration/main_test.go
new file mode 100644
index 00000000..fb272bf4
--- /dev/null
+++ b/integrate_test/config-api/config-merge/tests/integration/main_test.go
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package integration
+
+import (
+ "testing"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+)
+
+import (
+ "github.com/apache/dubbo-go-samples/api"
+)
+
+var userProvider = &api.GreeterClientImpl{}
+
+func TestMain(m *testing.M) {
+ config.SetConsumerService(userProvider)
+ err := config.Load()
+ if err != nil {
+ panic(err)
+ }
+}
diff --git
a/integrate_test/config-api/config-merge/tests/integration/merge_test.go
b/integrate_test/config-api/config-merge/tests/integration/merge_test.go
new file mode 100644
index 00000000..505c21b1
--- /dev/null
+++ b/integrate_test/config-api/config-merge/tests/integration/merge_test.go
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package integration
+
+import (
+ "context"
+ "testing"
+)
+
+import (
+ "github.com/stretchr/testify/assert"
+)
+
+import (
+ "github.com/apache/dubbo-go-samples/api"
+)
+
+func TestToken(t *testing.T) {
+ user, err := userProvider.SayHello(context.TODO(),
&api.HelloRequest{Name: "dubbo-go"})
+
+ assert.Nil(t, err)
+ assert.Equal(t, "Hello dubbo-go", user.Name)
+ assert.Equal(t, "12345", user.Id)
+ assert.Equal(t, 21, user.Age)
+
+}
diff --git a/integrate_test/filter/token/tests/integration/main_test.go
b/integrate_test/filter/token/tests/integration/main_test.go
new file mode 100644
index 00000000..fb272bf4
--- /dev/null
+++ b/integrate_test/filter/token/tests/integration/main_test.go
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package integration
+
+import (
+ "testing"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/config"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+)
+
+import (
+ "github.com/apache/dubbo-go-samples/api"
+)
+
+var userProvider = &api.GreeterClientImpl{}
+
+func TestMain(m *testing.M) {
+ config.SetConsumerService(userProvider)
+ err := config.Load()
+ if err != nil {
+ panic(err)
+ }
+}
diff --git a/integrate_test/filter/token/tests/integration/token_test.go
b/integrate_test/filter/token/tests/integration/token_test.go
new file mode 100644
index 00000000..505c21b1
--- /dev/null
+++ b/integrate_test/filter/token/tests/integration/token_test.go
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package integration
+
+import (
+ "context"
+ "testing"
+)
+
+import (
+ "github.com/stretchr/testify/assert"
+)
+
+import (
+ "github.com/apache/dubbo-go-samples/api"
+)
+
+func TestToken(t *testing.T) {
+ user, err := userProvider.SayHello(context.TODO(),
&api.HelloRequest{Name: "dubbo-go"})
+
+ assert.Nil(t, err)
+ assert.Equal(t, "Hello dubbo-go", user.Name)
+ assert.Equal(t, "12345", user.Id)
+ assert.Equal(t, 21, user.Age)
+
+}
diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index 26dd2bef..9b825e27 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -23,6 +23,7 @@ array+=("game/go-server-gate")
array=("config-api/rpc/triple")
array+=("config-api/configcenter/nacos")
array+=("config-api/configcenter/zookeeper")
+array=("config-api/config-merge")
# error
array+=("error/triple/hessian2")
@@ -39,6 +40,7 @@ array+=("direct")
# filer
array+=("filter/custom")
+array+=("filter/token")
# context
array+=("context/dubbo")