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 c4fc5ee0ac07dfc840e7eb0ac285837beb1d0d89 Author: Joe Zou <yixian....@gmail.com> AuthorDate: Wed Oct 21 23:04:52 2020 +0800 add auto generate test script and test it in metric/dubbo --- {direct/dubbo => .integration/testing}/.travis.yml | 6 ++-- .integration/testing/integration_testing.sh | 31 +++++++++++++++++++ ci.sh | 16 ++++++++++ direct/dubbo/.travis.yml | 2 +- gen_integrate_test.sh | 36 ++++++++++++++++++++++ {direct => metric}/dubbo/.travis.yml | 8 ++--- metric/dubbo/go-client/integration_testing.sh | 31 +++++++++++++++++++ metric/dubbo/go-server/integration_testing.sh | 31 +++++++++++++++++++ 8 files changed, 153 insertions(+), 8 deletions(-) diff --git a/direct/dubbo/.travis.yml b/.integration/testing/.travis.yml similarity index 74% copy from direct/dubbo/.travis.yml copy to .integration/testing/.travis.yml index b1d86d7..7ce5f91 100644 --- a/direct/dubbo/.travis.yml +++ b/.integration/testing/.travis.yml @@ -1,11 +1,11 @@ stages: - - Test direct + - Test %DIR% jobs: include: - - stage: Test direct + - stage: Test %DIR% script: - PROJECT_HOME=$(pwd) - - CASE_HOME=/direct/dubbo + - CASE_HOME=%DIR% - GO_SERVER=/go-server - GO_CLIENT=/go-client - docker run -d --network host zookeeper diff --git a/.integration/testing/integration_testing.sh b/.integration/testing/integration_testing.sh new file mode 100755 index 0000000..49f7b49 --- /dev/null +++ b/.integration/testing/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/ci.sh b/ci.sh index 23bcad7..f1a214a 100644 --- a/ci.sh +++ b/ci.sh @@ -1,3 +1,19 @@ +# +# 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. + allSamples=`find .|grep /assembly/linux/dev.sh | awk '{gsub("/assembly/linux/dev.sh","");print}'` currentFolder=`pwd` diff --git a/direct/dubbo/.travis.yml b/direct/dubbo/.travis.yml index b1d86d7..e6e311d 100644 --- a/direct/dubbo/.travis.yml +++ b/direct/dubbo/.travis.yml @@ -6,7 +6,7 @@ jobs: script: - PROJECT_HOME=$(pwd) - CASE_HOME=/direct/dubbo - - GO_SERVER=/go-server + - GO_SERVER=%GO_SERVER% - GO_CLIENT=/go-client - docker run -d --network host zookeeper - echo "zookeeper listen in [:]2181" diff --git a/gen_integrate_test.sh b/gen_integrate_test.sh new file mode 100755 index 0000000..22c5507 --- /dev/null +++ b/gen_integrate_test.sh @@ -0,0 +1,36 @@ +# +# 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. + +read -p "Enter integrate testing dir ( Like: direct/dubbo ) : " dir +echo "Generating auto test case for $dir " +if [ ! -d "$dir/go-client" ]; then + mkdir "$dir/go-client" + echo "Create $dir/go-client success. " +fi + +if [ ! -d "$dir/go-server" ]; then + mkdir "$dir/go-server" + echo "Create $dir/go-server success. " +fi + +echo "Copy travis.yml.... " +targetDir=${dir//\//\\\/} +sed "s/%DIR%/$targetDir/g" .integration/testing/.travis.yml > $dir/.travis.yml + +echo "Copy integration_testing.sh.... " +cp .integration/testing/integration_testing.sh $dir/go-client/ +cp .integration/testing/integration_testing.sh $dir/go-server/ +echo "Auto test case for $dir finished!" \ No newline at end of file diff --git a/direct/dubbo/.travis.yml b/metric/dubbo/.travis.yml similarity index 72% copy from direct/dubbo/.travis.yml copy to metric/dubbo/.travis.yml index b1d86d7..2b231e4 100644 --- a/direct/dubbo/.travis.yml +++ b/metric/dubbo/.travis.yml @@ -1,11 +1,11 @@ stages: - - Test direct + - Test metric/dubbo jobs: include: - - stage: Test direct + - stage: Test metric/dubbo script: - PROJECT_HOME=$(pwd) - - CASE_HOME=/direct/dubbo + - CASE_HOME=metric/dubbo - GO_SERVER=/go-server - GO_CLIENT=/go-client - docker run -d --network host zookeeper @@ -13,4 +13,4 @@ jobs: - 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} \ No newline at end of file + - ./integration_testing.sh ${PROJECT_HOME} ${GO_CLIENT} diff --git a/metric/dubbo/go-client/integration_testing.sh b/metric/dubbo/go-client/integration_testing.sh new file mode 100755 index 0000000..49f7b49 --- /dev/null +++ b/metric/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/metric/dubbo/go-server/integration_testing.sh b/metric/dubbo/go-server/integration_testing.sh new file mode 100755 index 0000000..49f7b49 --- /dev/null +++ b/metric/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