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 f5b6d157 feat: registry-all integrate test (#521)
f5b6d157 is described below

commit f5b6d15704b1c72112179c67fb41c8b3da207ebc
Author: ZLBer <[email protected]>
AuthorDate: Sat Mar 4 13:06:16 2023 +0800

    feat: registry-all integrate test (#521)
    
    * feat: tls integrate test
    
    * feat: tls integrate test
    
    * feat: tls integrate test
    
    * feat: registry-all integrate test
---
 .../all/nacos/tests/integration/greeter_test.go    | 41 ++++++++++++++++++++++
 .../all/nacos/tests/integration/main_test.go       | 38 ++++++++++++++++++++
 .../zookeeper/tests/integration/greeter_test.go    | 41 ++++++++++++++++++++++
 .../all/zookeeper/tests/integration/main_test.go   | 38 ++++++++++++++++++++
 start_integrate_test.sh                            |  2 ++
 5 files changed, 160 insertions(+)

diff --git 
a/integrate_test/registry/all/nacos/tests/integration/greeter_test.go 
b/integrate_test/registry/all/nacos/tests/integration/greeter_test.go
new file mode 100644
index 00000000..16089621
--- /dev/null
+++ b/integrate_test/registry/all/nacos/tests/integration/greeter_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/apache/dubbo-go-samples/api"
+       "github.com/stretchr/testify/assert"
+)
+
+func TestGreeter(t *testing.T) {
+       req := &api.HelloRequest{
+               Name: "dubbo-go",
+       }
+       reply, err := grpcGreeterImpl.SayHello(context.Background(), req)
+       assert.Nil(t, err, nil)
+
+       assert.Equal(t, 21, reply.Age)
+       assert.Equal(t, "12345", reply.Id)
+       assert.Equal(t, "Hello dubbo-go", reply.Name)
+
+}
diff --git a/integrate_test/registry/all/nacos/tests/integration/main_test.go 
b/integrate_test/registry/all/nacos/tests/integration/main_test.go
new file mode 100644
index 00000000..7917e620
--- /dev/null
+++ b/integrate_test/registry/all/nacos/tests/integration/main_test.go
@@ -0,0 +1,38 @@
+/*
+ * 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"
+
+       "github.com/apache/dubbo-go-samples/api"
+)
+
+var grpcGreeterImpl = &api.GreeterClientImpl{}
+
+func TestMain(m *testing.M) {
+       config.SetConsumerService(grpcGreeterImpl)
+       if err := config.Load(); err != nil {
+               panic(err)
+       }
+}
diff --git 
a/integrate_test/registry/all/zookeeper/tests/integration/greeter_test.go 
b/integrate_test/registry/all/zookeeper/tests/integration/greeter_test.go
new file mode 100644
index 00000000..16089621
--- /dev/null
+++ b/integrate_test/registry/all/zookeeper/tests/integration/greeter_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/apache/dubbo-go-samples/api"
+       "github.com/stretchr/testify/assert"
+)
+
+func TestGreeter(t *testing.T) {
+       req := &api.HelloRequest{
+               Name: "dubbo-go",
+       }
+       reply, err := grpcGreeterImpl.SayHello(context.Background(), req)
+       assert.Nil(t, err, nil)
+
+       assert.Equal(t, 21, reply.Age)
+       assert.Equal(t, "12345", reply.Id)
+       assert.Equal(t, "Hello dubbo-go", reply.Name)
+
+}
diff --git 
a/integrate_test/registry/all/zookeeper/tests/integration/main_test.go 
b/integrate_test/registry/all/zookeeper/tests/integration/main_test.go
new file mode 100644
index 00000000..7917e620
--- /dev/null
+++ b/integrate_test/registry/all/zookeeper/tests/integration/main_test.go
@@ -0,0 +1,38 @@
+/*
+ * 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"
+
+       "github.com/apache/dubbo-go-samples/api"
+)
+
+var grpcGreeterImpl = &api.GreeterClientImpl{}
+
+func TestMain(m *testing.M) {
+       config.SetConsumerService(grpcGreeterImpl)
+       if err := config.Load(); err != nil {
+               panic(err)
+       }
+}
diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index 5cdf4c27..eba71950 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -50,6 +50,8 @@ array+=("registry/nacos")
 array+=("registry/etcd")
 array+=("registry/servicediscovery/zookeeper")
 array+=("registry/servicediscovery/nacos")
+array+=("registry/all/zookeeper")
+array+=("registry/all/nacos")
 
 # generic
 array+=("generic/default")

Reply via email to