[
https://issues.apache.org/jira/browse/SOLR-17508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17892190#comment-17892190
]
Jan Høydahl commented on SOLR-17508:
------------------------------------
A Pester test could look something like this
({{{}PesterTests/solr-startstop.Test.ps1{}}})
{code:java}
Import-Module Pester
BeforeAll {
& "bin\solr.cmd" stop -all 2>&1
}
Describe "Solr CMD tests" {
It "solr start stop" {
# Start two instances of Solr
& "bin\solr.cmd" start -p 8888
& "bin\solr.cmd" start -p 9999
# Assert Solr instances are running
& "bin\solr.cmd" assert --started "http://localhost:8888/solr" --timeout 5000
& "bin\solr.cmd" assert --started "http://localhost:9999/solr" --timeout 5000
$output = & "bin\solr.cmd" stop -all 2>&1
$output | Should Contain "Stopping Solr process"
}
} {code}
And could be wired into Gradle with something like this (conditional on
OS=Windows)
{code:java}
task runPesterTests(type: Exec) {
description = 'Run Pester tests using PowerShell'
commandLine 'pwsh', '-Command', 'Invoke-Pester -Path ./PesterTests/'
}
check.dependsOn runPesterTests {code}
I tried a test locally and was able to get it running and starting Solr, but it
hung forever so could not complete tests. However, I'm sure it is possible. We
could then port every BATS test one by one..
> Integration tests of bin/solr.cmd on Windows
> --------------------------------------------
>
> Key: SOLR-17508
> URL: https://issues.apache.org/jira/browse/SOLR-17508
> Project: Solr
> Issue Type: Task
> Security Level: Public(Default Security Level. Issues are Public)
> Components: scripts and tools, test-framework
> Reporter: Jan Høydahl
> Priority: Major
>
> For Linux we have BATS that runs integration tests. For Windows we do not
> have anything, so it is not uncommon that bin/solr.cmd is buggy after
> touching the scripts.
> In this issue I propose looking at [https://github.com/pester/Pester] to try
> to write some integration tests for bin/solr.cmd. It is a test framework for
> Powershell, and is able to execute commands and check their output.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]