Skip to content

fix test cases that failed due to timeout. #36

fix test cases that failed due to timeout.

fix test cases that failed due to timeout. #36

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
# Allow running this workflow manually from the Actions tab
workflow_dispatch:
inputs:
job:
options:
- test
jobs:
test:
name: Test
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
OPENGAUSS_IMAGE: opengauss/opengauss:7.0.0-RC1.B023
OPENGAUSS_PASSWORD: Gaussdb@789!
MOUNT_DIR: /tmp
MOUNT_DIR_IN_CONTAINER: /tmp
CONTAINER_NAME: opengauss
SQL_FILE: opengauss_setup.sql
PORT: 5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Check formatting
run: |
gofmt -l -s -w .
git status
git diff --exit-code
- name: Copy setup.sql
run: |
sudo cp -rf "${{ github.workspace }}/testsetup/${{ env.SQL_FILE }}" "${MOUNT_DIR}/"
- name: Run opengauss
run: |
docker run \
--name ${CONTAINER_NAME} \
--privileged=true \
-d \
-e GS_PASSWORD=${OPENGAUSS_PASSWORD} \
-v ${MOUNT_DIR}:${MOUNT_DIR_IN_CONTAINER} \
-v "/var/run/docker.sock":"/var/run/docker.sock" \
-p ${PORT}:${PORT} "${OPENGAUSS_IMAGE}"
- name: Check and create database and users
run: bash ci/initialize_database.sh
- name: Run tests
env:
IS_OPENGAUSS: true
GAUSSDB_DATABASE: gaussdbgo_test
GAUSSDB_PORT: 5432
GAUSSDB_USER: gaussdb
GAUSSDB_HOST: localhost
GAUSSDB_DATA_DIR: /var/lib/opengauss/data
GAUSSDB_TEST_CRATEDB_CONN_STRING: "host=localhost port=${{ env.PORT }} user=gaussdb dbname=gaussdbgo_test password=${{ env.OPENGAUSS_PASSWORD }}"
GAUSSDB_TEST_DATABASE: "host=localhost database=gaussdbgo_test user=gaussdbgo_md5 password=${{ env.OPENGAUSS_PASSWORD }}"
GAUSSDB_TEST_MD5_PASSWORD_CONN_STRING: "host=localhost database=gaussdbgo_test user=gaussdbgo_md5 password=${{ env.OPENGAUSS_PASSWORD }}"
GAUSSDB_TEST_PLAIN_PASSWORD_CONN_STRING: "host=localhost user=gaussdbgo_pw password=${{ env.OPENGAUSS_PASSWORD }}"
GAUSSDB_TEST_SCRAM_PASSWORD_CONN_STRING: "host=localhost user=gaussdbgo_scram database=gaussdbgo_test password=${{ env.OPENGAUSS_PASSWORD }}"
GAUSSDB_TEST_TCP_CONN_STRING: "host=localhost database=gaussdbgo_test user=gaussdbgo_md5 password=${{ env.OPENGAUSS_PASSWORD }}"
# parallel testing is disabled because somehow parallel testing causes Github Actions to kill the runner.
run: |
go test -parallel=1 -race -timeout 50m -v ./...