Skip to content

Commit d5e21e4

Browse files
p3rf Teamcopybara-github
authored andcommitted
Add support for custom driver to be installed for performance test.
PiperOrigin-RevId: 853400478
1 parent 4edf338 commit d5e21e4

File tree

2 files changed

+53
-7
lines changed

2 files changed

+53
-7
lines changed

perfkitbenchmarker/data/relational_db_configs/sqlserver_ha_configs/check_sql_server_status.ps1

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
param (
2+
[string]$skip_cluster_check = 'False'
3+
)
14

25
function Get-SqlServiceStatus {
36
$sqlServerService = Get-Service -Name 'MSSQLSERVER' -ErrorAction SilentlyContinue
@@ -54,7 +57,12 @@ try {
5457
for (($i = 0); $i -lt 24; $i++) {
5558

5659
$serviceRunning = Get-SqlServiceStatus
57-
$isClustered = Get-ClusterStatus
60+
if ($skip_cluster_check -eq 'True') {
61+
$isClustered = $true
62+
}
63+
else {
64+
$isClustered = Get-ClusterStatus
65+
}
5866
$canConnect = Get-SqlServerConnectionState -HostName $localServerName
5967

6068
if ($serviceRunning -and $isClustered -and $canConnect) {
@@ -80,5 +88,3 @@ catch {
8088
Write-Host $_.Exception.Message
8189
throw $_.Exception.Message
8290
}
83-
84-

perfkitbenchmarker/data/relational_db_configs/sqlserver_ha_configs/set_dns_join_domain.ps1

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ param (
66

77
$domainUser = "$perf_domain\pkbadminuser"
88
$domainName = "$perf_domain.local"
9+
$connectionVerified = $false
910

1011
$passwordSecureString = (ConvertTo-SecureString -AsPlainText $perf_password -Force)
1112
$nic = Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias 'E*'
@@ -17,10 +18,49 @@ Set-DnsClientServerAddress -InterfaceIndex $nic[0].ifIndex -ServerAddresses $dns
1718

1819
$dns_server = Get-DnsClientServerAddress -InterfaceIndex $nic[0].ifIndex -AddressFamily IPv4
1920

21+
if (Test-Connection -ComputerName $DomainName -Count 1 -Quiet) {
22+
Write-Host 'Network connectivity to $DomainName is successful.'
23+
}
24+
else {
25+
Write-Host 'Cannot reach $DomainName via ICMP. Check DNS settings and network connectivity.'
26+
}
27+
28+
for ($i=0; $i -lt 10; $i++) {
29+
try {
30+
$test_connection = Test-NetConnection -ComputerName $DomainName -Port 135
31+
if ($test_connection.TcpTestSucceeded) {
32+
Write-Host 'Network connectivity to $DomainName on port 135 is successful.'
33+
$connectionVerified = $true
34+
break
35+
}
36+
else {
37+
Write-Host 'Cannot reach $DomainName on port 135.'
38+
Start-Sleep -Seconds 30
39+
}
40+
}
41+
catch {
42+
Start-Sleep -Seconds 30
43+
}
44+
}
45+
46+
if (-not $connectionVerified) {
47+
throw 'Cannot reach $DomainName.'
48+
}
49+
2050
if ($dns_server.ServerAddresses -eq $dns_server_ip) {
21-
Write-Host "DNS Set. Joining $domainName Domain"
22-
$credObject = New-Object System.Management.Automation.PSCredential ($domainUser, $passwordSecureString)
51+
for ($i=0; $i -lt 3; $i++) {
52+
try {
53+
Write-Host "DNS Set. Joining $domainName Domain"
54+
$credObject = New-Object System.Management.Automation.PSCredential ($domainUser, $passwordSecureString)
2355

24-
Add-Computer -DomainName $domainName -credential $credObject
25-
Write-Host 'Done'
56+
Add-Computer -DomainName $domainName -credential $credObject -ErrorAction Stop -PassThru
57+
Write-Host 'Done'
58+
break
59+
}
60+
catch {
61+
Write-Host 'Domain join test failed. Review the error details below:'
62+
Write-Error $_.Exception.Message
63+
Start-Sleep -Seconds 30
64+
}
65+
}
2666
}

0 commit comments

Comments
 (0)