From 09511698f03323387b131921b76e8c16fc14e512 Mon Sep 17 00:00:00 2001 From: mikatong Date: Mon, 10 Jan 2022 18:00:57 +0800 Subject: [PATCH 1/2] [fix]update githook=>pre-commit --- .githooks/pre-commit | 47 +++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 244900c95e..34dbd2e01c 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -6,17 +6,17 @@ if [ $? -ne 0 ]; then exit 1 fi -make test-build -if [ $? -ne 0 ]; then - printf "COMMIT FAILED\n" - exit 1 -fi - -make lint -if [ $? -ne 0 ]; then - printf "COMMIT FAILED\n" - exit 1 -fi +#make test-build +#if [ $? -ne 0 ]; then +# printf "COMMIT FAILED\n" +# exit 1 +#fi +# +#make lint +#if [ $? -ne 0 ]; then +# printf "COMMIT FAILED\n" +# exit 1 +#fi printf "==> Generating docs for tencentcloud provider...\n" doc=`make doc 2>&1` @@ -26,11 +26,11 @@ if [ $? -ne 0 ]; then exit 1 fi -make website-lint -if [ $? -ne 0 ]; then - printf "COMMIT FAILED\n" - exit 1 -fi +#make website-lint +#if [ $? -ne 0 ]; then +# printf "COMMIT FAILED\n" +# exit 1 +#fi diff=`git diff --name-only website/docs/` if [ "$diff" != "" ]; then @@ -39,5 +39,20 @@ if [ "$diff" != "" ]; then exit 1 fi +# go test check +delta_test_files=`git diff --name-status origin/master | egrep "_test\.go$" | awk '{print $2}'` +for delta_test_file in ${delta_test_files}; do + test_casts=`egrep "func TestAcc.+\(" ./tencentcloud/data_source_tc_gaap_proxies_test.go | awk -F "(" '{print $1}' | awk '{print $2}'` + for test_cast in ${test_casts}; do + go_test_cmd="go test -v -run ${test_cast} -timeout=0 ./tencentcloud/" + echo ${go_test_cmd} + $go_test_cmd + if [ $? -ne 0 ]; then + printf "[GO TEST FILED] ${go_test_cmd}" + exit 1 + fi + done +done + printf "COMMIT READY\n" exit 0 From 31f43b3c51f6a24dd33de3f4a86a3ac4b4db865d Mon Sep 17 00:00:00 2001 From: mikatong Date: Mon, 10 Jan 2022 20:52:24 +0800 Subject: [PATCH 2/2] [fix]update pre-commit --- .githooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 34dbd2e01c..d9308038c1 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -42,7 +42,7 @@ fi # go test check delta_test_files=`git diff --name-status origin/master | egrep "_test\.go$" | awk '{print $2}'` for delta_test_file in ${delta_test_files}; do - test_casts=`egrep "func TestAcc.+\(" ./tencentcloud/data_source_tc_gaap_proxies_test.go | awk -F "(" '{print $1}' | awk '{print $2}'` + test_casts=`egrep "func TestAcc.+\(" ${delta_test_file} | awk -F "(" '{print $1}' | awk '{print $2}'` for test_cast in ${test_casts}; do go_test_cmd="go test -v -run ${test_cast} -timeout=0 ./tencentcloud/" echo ${go_test_cmd}