Skip to content

Commit

Permalink
Save tests from Windows tests + do not fail if junit file not found
Browse files Browse the repository at this point in the history
  • Loading branch information
feloy committed Jun 7, 2023
1 parent 3231ca4 commit 001c43d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
14 changes: 11 additions & 3 deletions .ibm/pipelines/windows-test-script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,19 @@ function Run-Test {
make install
Shout "Running test"
make test-integration-no-cluster | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
$EXITCODE=$LASTEXITCODE
Copy-Item test-integration-nc.xml -Destination C:/Users/Administrator.ANSIBLE-TEST-VS/AppData/Local/Temp
Check-ExitCode $EXITCODE

make test-integration-cluster | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
$EXITCODE=$LASTEXITCODE
Copy-Item test-integration.xml -Destination C:/Users/Administrator.ANSIBLE-TEST-VS/AppData/Local/Temp
Check-ExitCode $EXITCODE

make test-e2e | tee -a C:\Users\Administrator.ANSIBLE-TEST-VS\AppData\Local\Temp\$LOGFILE
Check-ExitCode $LASTEXITCODE
$EXITCODE=$LASTEXITCODE
Copy-Item test-e2e.xml -Destination C:/Users/Administrator.ANSIBLE-TEST-VS/AppData/Local/Temp
Check-ExitCode $EXITCODE

Pop-Location
Shout "Test Finished"
Expand Down
14 changes: 11 additions & 3 deletions .ibm/pipelines/windows-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# using the IBM DevOps Services.
#

set -x

source .ibm/pipelines/functions.sh

skip_if_only

LOGFILE="pr-${GIT_PR_NUMBER}-windows-tests-${BUILD_NUMBER}"
TEST_NAME="Windows Tests (OCP)"

export REPO=${REPO:-"https://github.com/redhat-developer/odo"}
#copy test script inside /tmp/
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no ./.ibm/pipelines/windows-test-script.ps1 Administrator@$WINDOWS_IP:/tmp/windows-test-script.ps1
Expand All @@ -25,7 +25,15 @@ echo "RESULT: $RESULT"
# save log
ibmcloud login --apikey "${API_KEY}" -r "${IBM_REGION}"
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:~/AppData/Local/Temp/${LOGFILE} /tmp/${LOGFILE}
save_logs "${LOGFILE}" "Windows Tests (OCP)" $RESULT
save_logs "${LOGFILE}" "${TEST_NAME}" $RESULT

# save results
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:~/AppData/Local/Temp/test-integration-nc.xml /tmp/
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:~/AppData/Local/Temp/test-integration.xml /tmp/
sshpass -p $WINDOWS_PASSWORD scp -o StrictHostKeyChecking=no Administrator@$WINDOWS_IP:~/AppData/Local/Temp/test-e2e.xml /tmp/
save_results "/tmp/test-integration-nc.xml" "${LOGFILE}" "${TEST_NAME}"
save_results "/tmp/test-integration.xml" "${LOGFILE}" "${TEST_NAME}"
save_results "/tmp/test-e2e.xml" "${LOGFILE}" "${TEST_NAME}"

# cleanup
sshpass -p $WINDOWS_PASSWORD ssh Administrator@$WINDOWS_IP -o StrictHostKeyChecking=no rm -rf /tmp/windows-test-script.ps1
Expand Down
5 changes: 5 additions & 0 deletions .ibm/tools/tests-results/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"errors"
"flag"
"fmt"
"log"
Expand Down Expand Up @@ -69,6 +70,10 @@ func main() {

suites, err := junit.IngestFile(junitFile)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
fmt.Printf("junit file %s not found. Exiting\n", junitFile)
return
}
panic(err)
}

Expand Down

0 comments on commit 001c43d

Please sign in to comment.