diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d9139b3a25..c454b8726d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -23,9 +23,9 @@ jobs: - "1.21" clickhouse: # https://github.com/ClickHouse/ClickHouse/blob/master/SECURITY.md#scope-and-supported-versions - "23.3" - - "23.6" - - "23.7" - "23.8" + - "23.9" + - "23.10" - "latest" steps: - uses: actions/checkout@main @@ -41,7 +41,6 @@ jobs: CLICKHOUSE_VERSION=${{ matrix.clickhouse }} make test integration-tests-cloud: - if: ${{ false }} # disabled for now runs-on: [self-hosted, style-checker] defaults: run: @@ -66,27 +65,28 @@ jobs: id: init run: terraform init + - name: Set Service Name + run: echo "TF_VAR_service_name=go_client_tests_$(date +'%Y_%m_%d_%H_%M_%S')_${{ matrix.go }}" >> $GITHUB_ENV + - name: Terraform Validate id: validate run: terraform validate -no-color - - name: Set Service Name - run: echo "TF_VAR_service_name=go_client_tests_$(date +'%Y_%m_%d_%H_%M_%S')" >> $GITHUB_ENV - - name: Terraform Apply id: apply - run: terraform apply -no-color -auto-approve + run: terraform apply -no-color -auto-approve -state=${{ matrix.go }}.tfstate env: TF_VAR_organization_id: ${{ secrets.INTEGRATIONS_TEAM_TESTS_ORGANIZATION_ID }} TF_VAR_token_key: ${{ secrets.INTEGRATIONS_TEAM_TESTS_TOKEN_KEY }} TF_VAR_token_secret: ${{ secrets.INTEGRATIONS_TEAM_TESTS_TOKEN_SECRET }} TF_VAR_service_password: ${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD }} + TF_VAR_api_url: ${{ secrets.INTEGRATIONS_TEAM_TESTS_API_URL }} - name: Set Host - run: echo "CLICKHOUSE_HOST=$(terraform output -raw CLICKHOUSE_HOST)" >> $GITHUB_ENV + run: echo "CLICKHOUSE_HOST=$(terraform output -state=${{ matrix.go }}.tfstate -raw CLICKHOUSE_HOST)" >> $GITHUB_ENV - name: Service Id - run: terraform output -raw SERVICE_ID + run: terraform output -state=${{ matrix.go }}.tfstate -raw SERVICE_ID - name: Install Go ${{ matrix.go }} uses: actions/setup-go@v2.1.5 @@ -104,8 +104,9 @@ jobs: - name: Cleanup if: always() - run: terraform destroy -no-color -auto-approve + run: terraform destroy -no-color -auto-approve -state=${{ matrix.go }}.tfstate env: + TF_VAR_api_url: ${{ secrets.INTEGRATIONS_TEAM_TESTS_API_URL }} TF_VAR_organization_id: ${{ secrets.INTEGRATIONS_TEAM_TESTS_ORGANIZATION_ID }} TF_VAR_token_key: ${{ secrets.INTEGRATIONS_TEAM_TESTS_TOKEN_KEY }} TF_VAR_token_secret: ${{ secrets.INTEGRATIONS_TEAM_TESTS_TOKEN_SECRET }} diff --git a/main.tf b/main.tf index 95a0e7da78..05dc184d2b 100644 --- a/main.tf +++ b/main.tf @@ -2,11 +2,15 @@ terraform { required_providers { clickhouse = { source = "ClickHouse/clickhouse" - version = "~> 0.0.2" + version = "~> 0.0.4" } } } +variable "api_url" { + type = string +} + variable "organization_id" { type = string } @@ -28,7 +32,7 @@ variable "service_password" { } provider clickhouse { - environment = "production" + api_url = var.api_url organization_id = var.organization_id token_key = var.token_key token_secret = var.token_secret @@ -39,7 +43,6 @@ resource "clickhouse_service" "service" { cloud_provider = "aws" region = "us-east-2" tier = "development" - idle_scaling = true password = var.service_password ip_access = [ diff --git a/tests/batch_release_connection_test.go b/tests/batch_release_connection_test.go index ba083e99f3..6b15bad697 100644 --- a/tests/batch_release_connection_test.go +++ b/tests/batch_release_connection_test.go @@ -6,10 +6,16 @@ import ( "github.com/ClickHouse/clickhouse-go/v2" "github.com/ClickHouse/clickhouse-go/v2/lib/driver" "github.com/stretchr/testify/require" + "strconv" "testing" ) func TestBatchReleaseConnection(t *testing.T) { + runInDocker, _ := strconv.ParseBool(GetEnv("CLICKHOUSE_USE_DOCKER", "true")) + if !runInDocker { + t.Skip("Skip test in cloud environment.") + } + conn, err := GetNativeConnection(nil, nil, &clickhouse.Compression{ Method: clickhouse.CompressionLZ4, }) @@ -42,6 +48,11 @@ func TestBatchReleaseConnection(t *testing.T) { } func TestBatchReleaseConnectionFlush(t *testing.T) { + runInDocker, _ := strconv.ParseBool(GetEnv("CLICKHOUSE_USE_DOCKER", "true")) + if !runInDocker { + t.Skip("Skip test in cloud environment.") + } + conn, err := GetNativeConnection(nil, nil, &clickhouse.Compression{ Method: clickhouse.CompressionLZ4, }) diff --git a/tests/json_test.go b/tests/json_test.go index 197dedb266..5cd7710d16 100644 --- a/tests/json_test.go +++ b/tests/json_test.go @@ -29,6 +29,7 @@ import ( "github.com/stretchr/testify/require" "log" "net" + "strconv" "testing" "time" ) @@ -927,6 +928,11 @@ func TestJSONMapInconsistentMapWithInterface(t *testing.T) { } func TestJSONMapInconsistentComplexMap(t *testing.T) { + runInDocker, _ := strconv.ParseBool(GetEnv("CLICKHOUSE_USE_DOCKER", "true")) + if !runInDocker { + t.Skip("Skip test in cloud environment. Not stable.") + } + conn, teardown := setupTest(t) defer teardown(t) ctx := context.Background()