Skip to content

Commit 4354e18

Browse files
committed
Create Cloud database
1 parent d518bd7 commit 4354e18

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

.github/workflows/Windows.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,24 @@ jobs:
4646
new-item ${{ github.workspace }}/install -itemtype directory
4747
new-item ${{ github.workspace }}/package -itemtype directory
4848
49+
- name: Create Test Database
50+
run: |
51+
$timestamp = [math]::Round([double](Get-Date -UFormat %s) * 1000)
52+
$database = "test${timestamp}_odbc"
53+
"TEST_DATABASE=$database" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
54+
55+
$creds = New-Object System.Management.Automation.PSCredential(`
56+
"default", (ConvertTo-SecureString "${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}" `
57+
-AsPlainText -Force))
58+
Invoke-WebRequest -Uri "https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?query=" `
59+
-Method POST `
60+
-ContentType "text/plain" -Body "create database $database" `
61+
-Credential $creds
62+
63+
- name: Print Test Database Name
64+
run: |
65+
Write-Host "The test database name is: $env:TEST_DATABASE"
66+
4967
- name: Clone the repo
5068
uses: actions/checkout@v4
5169
with:
@@ -171,14 +189,14 @@ jobs:
171189
-DriverName "ClickHouse ODBC Driver (ANSI)" `
172190
-DsnType "System" `
173191
-Platform "$platform" `
174-
-SetPropertyValue @("Url=${{ secrets.CLOUD_AWS_URL }}", "Compression=1")
192+
-SetPropertyValue @("Url=https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?database=$env:TEST_DATABASE", "Username=default", "Password=${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}", "Compression=1")
175193
176194
Add-OdbcDsn `
177195
-Name "ClickHouse AWS Unicode ZSTD" `
178196
-DriverName "ClickHouse ODBC Driver (Unicode)" `
179197
-DsnType "System" `
180198
-Platform "$platform" `
181-
-SetPropertyValue @("Url=${{ secrets.CLOUD_AWS_URL }}", "Compression=1")
199+
-SetPropertyValue @("Url=https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?database=$env:TEST_DATABASE", "Username=default", "Password=${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}", "Compression=1")
182200
183201
Write-Host "List of enabled DSNs:"
184202
Get-OdbcDsn -DsnType "System"
@@ -262,3 +280,18 @@ jobs:
262280
tag: ${{ github.ref }}
263281
file_glob: true
264282

283+
- name: Drop Test Database
284+
if: ${{ github.event_name == 'release' && matrix.build_type == 'Release' }}
285+
run: |
286+
$creds = New-Object System.Management.Automation.PSCredential(`
287+
"default", (ConvertTo-SecureString "${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_PASSWORD_SMT }}" `
288+
-AsPlainText -Force))
289+
$response = Invoke-WebRequest -Uri "https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?query=" `
290+
-Method POST `
291+
-ContentType "text/plain" -Body "select name from system.tables where database = '$env:TEST_DATABASE'" `
292+
-Credential $creds
293+
$response.Content
294+
Invoke-WebRequest -Uri "https://${{ secrets.INTEGRATIONS_TEAM_TESTS_CLOUD_HOST_SMT }}:8443/?query=" `
295+
-Method POST `
296+
-ContentType "text/plain" -Body "drop database if exists $env:TEST_DATABASE" `
297+
-Credential $creds

0 commit comments

Comments
 (0)