Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Cloud tests back #1136

Closed
wants to merge 13 commits into from
21 changes: 11 additions & 10 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 }}
Expand Down
9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand All @@ -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 = [
Expand Down
11 changes: 11 additions & 0 deletions tests/batch_release_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down Expand Up @@ -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,
})
Expand Down
6 changes: 6 additions & 0 deletions tests/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/stretchr/testify/require"
"log"
"net"
"strconv"
"testing"
"time"
)
Expand Down Expand Up @@ -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()
Expand Down
Loading