diff --git a/.github/workflows/bats-test.yml b/.github/workflows/bats-test.yml index b41795d..d49baea 100644 --- a/.github/workflows/bats-test.yml +++ b/.github/workflows/bats-test.yml @@ -3,24 +3,22 @@ on: push: paths: - AliyunOpenApiSDK.sh - - test.bats.sh + - test/test.bats.sh pull_request: paths: - AliyunOpenApiSDK.sh - - test.bats.sh + - test/test.bats.sh jobs: test: runs-on: ubuntu-18.04 # Test on old version bash steps: - - name: Setup BATS - uses: mig4/setup-bats@v1 - with: - bats-version: 1.8.2 - name: Check out code uses: actions/checkout@v3 + with: + submodules: true - name: Run test env: AliAccessKeyId: ${{ secrets.ALIACCESSKEYID }} AliAccessKeySecret: ${{ secrets.ALIACCESSKEYSECRET }} - run: bats test.bats.sh + run: ./test/bats/bin/bats test/test.bats.sh diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b7efcb4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "test/bats"] + path = test/bats + url = https://github.com/bats-core/bats-core.git +[submodule "test/test_helper/bats-support"] + path = test/test_helper/bats-support + url = https://github.com/bats-core/bats-support.git +[submodule "test/test_helper/bats-assert"] + path = test/test_helper/bats-assert + url = https://github.com/bats-core/bats-assert.git diff --git a/test/bats b/test/bats new file mode 160000 index 0000000..e8c840b --- /dev/null +++ b/test/bats @@ -0,0 +1 @@ +Subproject commit e8c840b58f0833e23461c682655fe540aa923f85 diff --git a/test.bats.sh b/test/test.bats.sh similarity index 95% rename from test.bats.sh rename to test/test.bats.sh index a78ee15..4b04eac 100755 --- a/test.bats.sh +++ b/test/test.bats.sh @@ -32,8 +32,7 @@ test_timestamp_rpc() { #@test run _aliapi_timestamp_rpc [[ $status -eq 0 ]] timestamp=$output - - run grep -P "^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T(0\d|[1]\d|2[0-3]):[0-5]\d:[0-5]\d(Z|\+00:00)$" <<< "$timestamp" + run grep -E "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(0[0-9]|[1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](Z|\+00:00)$" <<< "$timestamp" [[ $status -eq 0 ]] [[ $output == "$timestamp" ]] } diff --git a/test/test_helper/bats-assert b/test/test_helper/bats-assert new file mode 160000 index 0000000..78fa631 --- /dev/null +++ b/test/test_helper/bats-assert @@ -0,0 +1 @@ +Subproject commit 78fa631d1370562d2cd4a1390989e706158e7bf0 diff --git a/test/test_helper/bats-support b/test/test_helper/bats-support new file mode 160000 index 0000000..24a72e1 --- /dev/null +++ b/test/test_helper/bats-support @@ -0,0 +1 @@ +Subproject commit 24a72e14349690bcbf7c151b9d2d1cdd32d36eb1