From 2a818d230c6078bf7fd7d2daf9cb9cfa19f1cba9 Mon Sep 17 00:00:00 2001 From: hunterlong Date: Mon, 18 May 2020 13:26:02 -0700 Subject: [PATCH] postman API tests for different databases --- .github/workflows/master.yml | 140 +++++++++++++++++++++++++++++++++-- 1 file changed, 135 insertions(+), 5 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a04aea68..2cb4f5f5 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -143,7 +143,7 @@ jobs: env: COVERALLS: ${{ secrets.COVERALLS }} - test-postman: + test-postman-sqlite: needs: compile runs-on: ubuntu-latest steps: @@ -178,14 +178,144 @@ jobs: API_SECRET=demosecret123 statping --port=8080 > /dev/null & sleep 3 - - name: Postman Tests + - name: Postman SQLite Tests uses: matt-ball/newman-action@master with: postmanApiKey: ${{ secrets.POSTMAN_API }} - collection: 1898229-94807b85-ef65-4370-9144-b1a74e04cb0e - environment: ./dev/postman_environment.json + collection: 1898229-3c6a7841-0b39-4878-a3a6-1c76832b7679 + globals: + endpoint: http://127.0.0.1:8080 + api_key: demosecret123 + db_connection: sqlite timeoutRequest: 15000 - delayRequest: 1000 + delayRequest: 500 + + test-postman-mysql: + needs: compile + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password123 + MYSQL_DATABASE: statping + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '1.14.2' + + - name: Setting ENV's + run: | + echo "::add-path::$(go env GOPATH)/bin" + echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin" + echo ::set-env name=VERSION::$(cat version.txt) + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - name: Install Statping + env: + VERSION: ${{ env.VERSION }} + run: | + make build + chmod +x statping + mv statping $(go env GOPATH)/bin/ + + - name: Run Statping + run: | + API_SECRET=demosecret123 statping --port=8080 > /dev/null & + sleep 3 + + - name: Postman MySQL Tests + uses: matt-ball/newman-action@master + with: + postmanApiKey: ${{ secrets.POSTMAN_API }} + collection: 1898229-3c6a7841-0b39-4878-a3a6-1c76832b7679 + globals: + endpoint: http://127.0.0.1:8080 + api_key: demosecret123 + db_connection: mysql + db_host: localhost + db_user: root + db_password: password123 + db_database: statping + db_port: 3306 + timeoutRequest: 15000 + delayRequest: 500 + + test-postman-postgres: + needs: compile + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:10.8 + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: password123 + POSTGRES_DB: statping + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '1.14.2' + + - name: Setting ENV's + run: | + echo "::add-path::$(go env GOPATH)/bin" + echo "::add-path::/opt/hostedtoolcache/node/10.20.1/x64/bin" + echo ::set-env name=VERSION::$(cat version.txt) + shell: bash + + - name: Download Compiled Frontend (rice-box.go) + uses: actions/download-artifact@v1 + with: + name: static-rice-box + path: ./source + + - name: Install Statping + env: + VERSION: ${{ env.VERSION }} + run: | + make build + chmod +x statping + mv statping $(go env GOPATH)/bin/ + + - name: Run Statping + run: | + API_SECRET=demosecret123 statping --port=8080 > /dev/null & + sleep 3 + + - name: Postman Postgres Tests + uses: matt-ball/newman-action@master + with: + postmanApiKey: ${{ secrets.POSTMAN_API }} + collection: 1898229-3c6a7841-0b39-4878-a3a6-1c76832b7679 + globals: + endpoint: http://127.0.0.1:8080 + api_key: demosecret123 + db_connection: postgres + db_host: localhost + db_user: root + db_password: password123 + db_database: statping + db_port: 5432 + timeoutRequest: 15000 + delayRequest: 500 build-binaries: needs: compile