janhoy commented on code in PR #3810:
URL: https://github.com/apache/solr/pull/3810#discussion_r2481611669


##########
solr/packaging/powershell-tests/Zk.Tests.ps1:
##########
@@ -42,6 +42,81 @@ BeforeAll {
   $script:ZK_PORT = if ($env:ZK_PORT) { $env:ZK_PORT } else { "9983" }
   $script:SOLR_PORT = if ($env:SOLR_PORT) { $env:SOLR_PORT } else { "8983" }
 
+  # Check if Solr is already running
+  $solrAlreadyRunning = $false
+  try {
+    $response = Invoke-WebRequest -Uri "http://localhost:$SOLR_PORT/solr/"; 
-UseBasicParsing -TimeoutSec 2 -ErrorAction SilentlyContinue
+    if ($response.StatusCode -eq 200) {
+      $solrAlreadyRunning = $true
+      Write-Host "Solr is already running on port $SOLR_PORT"
+    }
+  } catch {
+    $solrAlreadyRunning = $false
+  }
+
+  $script:SolrStartedByTests = $false
+
+  # Start Solr if it's not already running
+  if (-not $solrAlreadyRunning) {
+    Write-Host "Starting Solr in cloud mode..."
+
+    # Start Solr with embedded ZooKeeper using Start-Process to run 
asynchronously
+    $startArgs = @("start", "-p", "$SOLR_PORT")
+    Write-Host "Running: $SolrCmd $($startArgs -join ' ')"

Review Comment:
   One of the assumptions for the BATS tests is that SOLR_PORT, SOLR2_PORT, 
ZK_PORT etc are set, and most tests just rely on picking up these (which is a 
feature in itself), but there are also other tests that explicitly tests the 
`-p` flag and the `-z` flag in varioud ways. 
   
   I'd say simplify. Keep it close to the BATS approach. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to