Skip to content

Commit 64f3449

Browse files
committed
Use another way to test if solr is running
1 parent 49ffa3c commit 64f3449

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

solr/packaging/powershell-tests/Zk.Tests.ps1

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,43 +109,50 @@ Describe "Solr Zk Command" {
109109
}
110110
}
111111

112-
It "listing out files" -Skip:(-not $SolrRunning) {
112+
It "listing out files" {
113+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
113114
Start-Sleep -Seconds 1
114115
$output = Test-CommandOutput @("zk", "ls", "/", "-z", "localhost:$ZK_PORT", "--recursive") "zk ls / -z localhost:$ZK_PORT --recursive"
115116
$output | Should -Match "aliases\.json"
116117
}
117118

118-
It "connecting via solr-url" -Skip:(-not $SolrRunning) {
119+
It "connecting via solr-url" {
120+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
119121
Start-Sleep -Seconds 1
120122
$output = Test-CommandOutput @("zk", "ls", "/", "--solr-url", "http://localhost:$SOLR_PORT") "zk ls / --solr-url http://localhost:$SOLR_PORT"
121123
$output | Should -Match "aliases\.json"
122124
}
123125

124-
It "connecting via -s flag" -Skip:(-not $SolrRunning) {
126+
It "connecting via -s flag" {
127+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
125128
Start-Sleep -Seconds 1
126129
$output = Test-CommandOutput @("zk", "ls", "/", "-s", "http://localhost:$SOLR_PORT") "zk ls / -s http://localhost:$SOLR_PORT"
127130
$output | Should -Match "aliases\.json"
128131
}
129132

130-
It "connecting via default (localhost)" -Skip:(-not $SolrRunning) {
133+
It "connecting via default (localhost)" {
134+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
131135
Start-Sleep -Seconds 1
132136
$output = Test-CommandOutput @("zk", "ls", "/") "zk ls /"
133137
$output | Should -Match "aliases\.json"
134138
}
135139

136-
It "connecting via -z flag" -Skip:(-not $SolrRunning) {
140+
It "connecting via -z flag" {
141+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
137142
Start-Sleep -Seconds 1
138143
$output = Test-CommandOutput @("zk", "ls", "/", "-z", "localhost:$ZK_PORT") "zk ls / -z localhost:$ZK_PORT"
139144
$output | Should -Match "aliases\.json"
140145
}
141146

142-
It "connecting via --zk-host flag" -Skip:(-not $SolrRunning) {
147+
It "connecting via --zk-host flag" {
148+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
143149
Start-Sleep -Seconds 1
144150
$output = Test-CommandOutput @("zk", "ls", "/", "--zk-host", "localhost:$ZK_PORT") "zk ls / --zk-host localhost:$ZK_PORT"
145151
$output | Should -Match "aliases\.json"
146152
}
147153

148-
It "copying files around" -Skip:(-not $SolrRunning) {
154+
It "copying files around" {
155+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
149156
$testFile = "testfile_$([System.IO.Path]::GetRandomFileName()).txt"
150157
try {
151158
# Create test file
@@ -168,7 +175,8 @@ Describe "Solr Zk Command" {
168175
}
169176
}
170177

171-
It "upconfig" -Skip:(-not $SolrRunning) {
178+
It "upconfig" {
179+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
172180
$sourceConfigsetDir = Join-Path $SolrTip "server\solr\configsets\sample_techproducts_configs"
173181
if (Test-Path $sourceConfigsetDir) {
174182
$output = Test-CommandOutput @("zk", "upconfig", "-d", $sourceConfigsetDir, "-n", "techproducts_ps_test", "-z", "localhost:$ZK_PORT") "zk upconfig"
@@ -179,7 +187,8 @@ Describe "Solr Zk Command" {
179187
}
180188
}
181189

182-
It "downconfig" -Skip:(-not $SolrRunning) {
190+
It "downconfig" {
191+
if (-not $script:SolrRunning) { Set-ItResult -Skipped -Because "Solr is not running"; return }
183192
$tempDir = [System.IO.Path]::GetTempPath()
184193
$downloadDir = Join-Path $tempDir "downconfig_$([System.IO.Path]::GetRandomFileName())"
185194
New-Item -ItemType Directory -Path $downloadDir -Force | Out-Null

0 commit comments

Comments
 (0)