This is an automated email from the ASF dual-hosted git repository.

joezou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git

commit 6c4dfb6a70d80b38b71d8e66ec3bab6b50f73855
Author: Joe Zou <yixian....@gmail.com>
AuthorDate: Fri Oct 23 17:19:39 2020 +0800

    add test for config_center case
---
 .travis.yml                                        |  3 ++
 configcenter/apollo/dubbo/.travis.yml              | 16 +++++++++++
 configcenter/apollo/dubbo/go-client/app/client.go  | 32 ++--------------------
 .../apollo/dubbo/go-client/integration_testing.sh  | 31 +++++++++++++++++++++
 .../apollo/dubbo/go-server/integration_testing.sh  | 31 +++++++++++++++++++++
 configcenter/nacos/dubbo/.travis.yml               | 16 +++++++++++
 configcenter/nacos/dubbo/go-client/app/client.go   | 32 ++--------------------
 .../nacos/dubbo/go-client/integration_testing.sh   | 31 +++++++++++++++++++++
 .../nacos/dubbo/go-server/integration_testing.sh   | 31 +++++++++++++++++++++
 configcenter/zookeeper/dubbo/.travis.yml           | 16 +++++++++++
 .../zookeeper/dubbo/go-client/app/client.go        | 32 ++--------------------
 .../dubbo/go-client/integration_testing.sh         | 31 +++++++++++++++++++++
 .../dubbo/go-server/integration_testing.sh         | 31 +++++++++++++++++++++
 13 files changed, 243 insertions(+), 90 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 6c851d0..236daf0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,3 +11,6 @@ import:
   - async/.travis.yml
   - metric/dubbo/.travis.yml
   - filter/custom_filter/dubbo/.travis.yml
+  - configcenter/apollo/dubbo/.travis.yml
+  - configcenter/zookeeper/dubbo/.travis.yml
+  - configcenter/nacos/dubbo/.travis.yml
diff --git a/configcenter/apollo/dubbo/.travis.yml 
b/configcenter/apollo/dubbo/.travis.yml
new file mode 100644
index 0000000..6be39c0
--- /dev/null
+++ b/configcenter/apollo/dubbo/.travis.yml
@@ -0,0 +1,16 @@
+stages:
+  - Test configcenter/apollo/dubbo
+jobs:
+  include:
+    - stage: Test configcenter/apollo/dubbo
+      script:
+        - PROJECT_HOME=$(pwd)
+        - CASE_HOME=/configcenter/apollo/dubbo
+        - GO_SERVER=/go-server
+        - GO_CLIENT=/go-client
+        - docker run -d --network host zookeeper
+        - echo "zookeeper listen in [:]2181"
+        - cd ${PROJECT_HOME}${CASE_HOME}${GO_SERVER}
+        - ./integration_testing.sh ${PROJECT_HOME} ${GO_SERVER} true
+        - cd ${PROJECT_HOME}${CASE_HOME}${GO_CLIENT}
+        - ./integration_testing.sh ${PROJECT_HOME} ${GO_CLIENT}
diff --git a/configcenter/apollo/dubbo/go-client/app/client.go 
b/configcenter/apollo/dubbo/go-client/app/client.go
index 0f7b9f6..31edbdc 100644
--- a/configcenter/apollo/dubbo/go-client/app/client.go
+++ b/configcenter/apollo/dubbo/go-client/app/client.go
@@ -19,10 +19,7 @@ package main
 
 import (
        "context"
-       "fmt"
        "os"
-       "os/signal"
-       "syscall"
        "time"
 )
 
@@ -32,7 +29,6 @@ import (
 
 import (
        hessian "github.com/apache/dubbo-go-hessian2"
-       "github.com/apache/dubbo-go/common/logger"
        _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
        "github.com/apache/dubbo-go/config"
        _ "github.com/apache/dubbo-go/protocol/dubbo"
@@ -62,32 +58,8 @@ func main() {
        user := &User{}
        err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
        if err != nil {
-               panic(err)
+               os.Exit(1)
+               return
        }
        gxlog.CInfo("response result: %v\n", user)
-       initSignal()
-}
-
-func initSignal() {
-       signals := make(chan os.Signal, 1)
-       // It is not possible to block SIGKILL or syscall.SIGSTOP
-       signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
-               syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
-       for {
-               sig := <-signals
-               logger.Infof("get signal %s", sig.String())
-               switch sig {
-               case syscall.SIGHUP:
-                       // reload()
-               default:
-                       time.AfterFunc(time.Duration(survivalTimeout), func() {
-                               logger.Warnf("app exit now by force...")
-                               os.Exit(1)
-                       })
-
-                       // The program exits normally or timeout forcibly exits.
-                       fmt.Println("app exit now...")
-                       return
-               }
-       }
 }
diff --git a/configcenter/apollo/dubbo/go-client/integration_testing.sh 
b/configcenter/apollo/dubbo/go-client/integration_testing.sh
new file mode 100755
index 0000000..49f7b49
--- /dev/null
+++ b/configcenter/apollo/dubbo/go-client/integration_testing.sh
@@ -0,0 +1,31 @@
+#
+#  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.
+
+#!/bin/bash
+
+set -e
+set -x
+
+rm -rf assembly
+cp -r $1/.integration/testing/$2/assembly .
+assembly/linux/dev.sh
+cd target/*/*/
+# is async
+if [[ $3 ]]; then
+       nohup bin/load.sh start > a.out&
+else
+       bin/load.sh start
+fi
\ No newline at end of file
diff --git a/configcenter/apollo/dubbo/go-server/integration_testing.sh 
b/configcenter/apollo/dubbo/go-server/integration_testing.sh
new file mode 100755
index 0000000..49f7b49
--- /dev/null
+++ b/configcenter/apollo/dubbo/go-server/integration_testing.sh
@@ -0,0 +1,31 @@
+#
+#  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.
+
+#!/bin/bash
+
+set -e
+set -x
+
+rm -rf assembly
+cp -r $1/.integration/testing/$2/assembly .
+assembly/linux/dev.sh
+cd target/*/*/
+# is async
+if [[ $3 ]]; then
+       nohup bin/load.sh start > a.out&
+else
+       bin/load.sh start
+fi
\ No newline at end of file
diff --git a/configcenter/nacos/dubbo/.travis.yml 
b/configcenter/nacos/dubbo/.travis.yml
new file mode 100644
index 0000000..009d4c7
--- /dev/null
+++ b/configcenter/nacos/dubbo/.travis.yml
@@ -0,0 +1,16 @@
+stages:
+  - Test configcenter/nacos/dubbo
+jobs:
+  include:
+    - stage: Test configcenter/nacos/dubbo
+      script:
+        - PROJECT_HOME=$(pwd)
+        - CASE_HOME=/configcenter/nacos/dubbo
+        - GO_SERVER=/go-server
+        - GO_CLIENT=/go-client
+        - docker run -d --network host zookeeper
+        - echo "zookeeper listen in [:]2181"
+        - cd ${PROJECT_HOME}${CASE_HOME}${GO_SERVER}
+        - ./integration_testing.sh ${PROJECT_HOME} ${GO_SERVER} true
+        - cd ${PROJECT_HOME}${CASE_HOME}${GO_CLIENT}
+        - ./integration_testing.sh ${PROJECT_HOME} ${GO_CLIENT}
diff --git a/configcenter/nacos/dubbo/go-client/app/client.go 
b/configcenter/nacos/dubbo/go-client/app/client.go
index e457052..87a9ad9 100644
--- a/configcenter/nacos/dubbo/go-client/app/client.go
+++ b/configcenter/nacos/dubbo/go-client/app/client.go
@@ -19,10 +19,7 @@ package main
 
 import (
        "context"
-       "fmt"
        "os"
-       "os/signal"
-       "syscall"
        "time"
 )
 
@@ -32,7 +29,6 @@ import (
 
 import (
        hessian "github.com/apache/dubbo-go-hessian2"
-       "github.com/apache/dubbo-go/common/logger"
        _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
        "github.com/apache/dubbo-go/config"
        _ "github.com/apache/dubbo-go/protocol/dubbo"
@@ -62,32 +58,8 @@ func main() {
        user := &User{}
        err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
        if err != nil {
-               panic(err)
+               os.Exit(1)
+               return
        }
        gxlog.CInfo("response result: %v\n", user)
-       initSignal()
-}
-
-func initSignal() {
-       signals := make(chan os.Signal, 1)
-       // It is not possible to block SIGKILL or syscall.SIGSTOP
-       signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
-               syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
-       for {
-               sig := <-signals
-               logger.Infof("get signal %s", sig.String())
-               switch sig {
-               case syscall.SIGHUP:
-                       // reload()
-               default:
-                       time.AfterFunc(time.Duration(survivalTimeout), func() {
-                               logger.Warnf("app exit now by force...")
-                               os.Exit(1)
-                       })
-
-                       // The program exits normally or timeout forcibly exits.
-                       fmt.Println("app exit now...")
-                       return
-               }
-       }
 }
diff --git a/configcenter/nacos/dubbo/go-client/integration_testing.sh 
b/configcenter/nacos/dubbo/go-client/integration_testing.sh
new file mode 100755
index 0000000..49f7b49
--- /dev/null
+++ b/configcenter/nacos/dubbo/go-client/integration_testing.sh
@@ -0,0 +1,31 @@
+#
+#  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.
+
+#!/bin/bash
+
+set -e
+set -x
+
+rm -rf assembly
+cp -r $1/.integration/testing/$2/assembly .
+assembly/linux/dev.sh
+cd target/*/*/
+# is async
+if [[ $3 ]]; then
+       nohup bin/load.sh start > a.out&
+else
+       bin/load.sh start
+fi
\ No newline at end of file
diff --git a/configcenter/nacos/dubbo/go-server/integration_testing.sh 
b/configcenter/nacos/dubbo/go-server/integration_testing.sh
new file mode 100755
index 0000000..49f7b49
--- /dev/null
+++ b/configcenter/nacos/dubbo/go-server/integration_testing.sh
@@ -0,0 +1,31 @@
+#
+#  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.
+
+#!/bin/bash
+
+set -e
+set -x
+
+rm -rf assembly
+cp -r $1/.integration/testing/$2/assembly .
+assembly/linux/dev.sh
+cd target/*/*/
+# is async
+if [[ $3 ]]; then
+       nohup bin/load.sh start > a.out&
+else
+       bin/load.sh start
+fi
\ No newline at end of file
diff --git a/configcenter/zookeeper/dubbo/.travis.yml 
b/configcenter/zookeeper/dubbo/.travis.yml
new file mode 100644
index 0000000..2dfbd5b
--- /dev/null
+++ b/configcenter/zookeeper/dubbo/.travis.yml
@@ -0,0 +1,16 @@
+stages:
+  - Test configcenter/zookeeper/dubbo
+jobs:
+  include:
+    - stage: Test configcenter/zookeeper/dubbo
+      script:
+        - PROJECT_HOME=$(pwd)
+        - CASE_HOME=/configcenter/zookeeper/dubbo
+        - GO_SERVER=/go-server
+        - GO_CLIENT=/go-client
+        - docker run -d --network host zookeeper
+        - echo "zookeeper listen in [:]2181"
+        - cd ${PROJECT_HOME}${CASE_HOME}${GO_SERVER}
+        - ./integration_testing.sh ${PROJECT_HOME} ${GO_SERVER} true
+        - cd ${PROJECT_HOME}${CASE_HOME}${GO_CLIENT}
+        - ./integration_testing.sh ${PROJECT_HOME} ${GO_CLIENT}
diff --git a/configcenter/zookeeper/dubbo/go-client/app/client.go 
b/configcenter/zookeeper/dubbo/go-client/app/client.go
index 5e73b0e..1be93e9 100644
--- a/configcenter/zookeeper/dubbo/go-client/app/client.go
+++ b/configcenter/zookeeper/dubbo/go-client/app/client.go
@@ -19,10 +19,7 @@ package main
 
 import (
        "context"
-       "fmt"
        "os"
-       "os/signal"
-       "syscall"
        "time"
 )
 
@@ -32,7 +29,6 @@ import (
 
 import (
        hessian "github.com/apache/dubbo-go-hessian2"
-       "github.com/apache/dubbo-go/common/logger"
        _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
        "github.com/apache/dubbo-go/config"
        _ "github.com/apache/dubbo-go/protocol/dubbo"
@@ -62,32 +58,8 @@ func main() {
        user := &User{}
        err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
        if err != nil {
-               panic(err)
+               os.Exit(1)
+               return
        }
        gxlog.CInfo("response result: %v\n", user)
-       initSignal()
-}
-
-func initSignal() {
-       signals := make(chan os.Signal, 1)
-       // It is not possible to block SIGKILL or syscall.SIGSTOP
-       signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
-               syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
-       for {
-               sig := <-signals
-               logger.Infof("get signal %s", sig.String())
-               switch sig {
-               case syscall.SIGHUP:
-                       // reload()
-               default:
-                       time.AfterFunc(time.Duration(survivalTimeout), func() {
-                               logger.Warnf("app exit now by force...")
-                               os.Exit(1)
-                       })
-
-                       // The program exits normally or timeout forcibly exits.
-                       fmt.Println("app exit now...")
-                       return
-               }
-       }
 }
diff --git a/configcenter/zookeeper/dubbo/go-client/integration_testing.sh 
b/configcenter/zookeeper/dubbo/go-client/integration_testing.sh
new file mode 100755
index 0000000..49f7b49
--- /dev/null
+++ b/configcenter/zookeeper/dubbo/go-client/integration_testing.sh
@@ -0,0 +1,31 @@
+#
+#  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.
+
+#!/bin/bash
+
+set -e
+set -x
+
+rm -rf assembly
+cp -r $1/.integration/testing/$2/assembly .
+assembly/linux/dev.sh
+cd target/*/*/
+# is async
+if [[ $3 ]]; then
+       nohup bin/load.sh start > a.out&
+else
+       bin/load.sh start
+fi
\ No newline at end of file
diff --git a/configcenter/zookeeper/dubbo/go-server/integration_testing.sh 
b/configcenter/zookeeper/dubbo/go-server/integration_testing.sh
new file mode 100755
index 0000000..49f7b49
--- /dev/null
+++ b/configcenter/zookeeper/dubbo/go-server/integration_testing.sh
@@ -0,0 +1,31 @@
+#
+#  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.
+
+#!/bin/bash
+
+set -e
+set -x
+
+rm -rf assembly
+cp -r $1/.integration/testing/$2/assembly .
+assembly/linux/dev.sh
+cd target/*/*/
+# is async
+if [[ $3 ]]; then
+       nohup bin/load.sh start > a.out&
+else
+       bin/load.sh start
+fi
\ No newline at end of file

Reply via email to