Skip to content

Commit

Permalink
Add ssh-client dependency to rowan image
Browse files Browse the repository at this point in the history
Move test reporting code to its own class
  • Loading branch information
gcotelli committed Aug 14, 2023
1 parent e35e2df commit 6f2aa31
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 89 deletions.
4 changes: 3 additions & 1 deletion source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ FROM docker-gs64-server as docker-gs64-rowan

# Install git
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends git \
&& apt-get install --assume-yes --no-install-recommends \
git \
ssh-client \
&& apt-get clean \
&& rm --recursive --force /var/lib/apt/lists/* /tmp/* /var/tmp/* \
;
Expand Down
113 changes: 113 additions & 0 deletions source/StdOutTestReporter.gs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
set compile_env: 0
! ------------------- Class definition for StdOutTestReporter
expectvalue /Class
doit
Object subclass: 'StdOutTestReporter'
instVarNames: #()
classVars: #()
classInstVars: #()
poolDictionaries: #()
inDictionary: Globals
options: #()

%
! ------------------- Remove existing behavior from StdOutTestReporter
expectvalue /Metaclass3
doit
StdOutTestReporter removeAllMethods.
StdOutTestReporter class removeAllMethods.
%
set compile_env: 0
! ------------------- Instance methods for StdOutTestReporter
category: 'reporting'
method: StdOutTestReporter
runTestsForProjectNamed: aProjectName

| suite result sortBlock currentTestClass |

suite := (Rowan projectNamed: aProjectName) testSuite.

StdOutPrinter printLine: [:s |
s << 'Running suite ' << suite name << ' with ' << suite tests size asString << ' tests.'.
].

result := suite run.

StdOutPrinter
printLine: [:s | s << '.............'];
printLine: [:s | s << 'Finished running suite: ' << suite name ];
printLine: [:s | ];
printInfo: [:s | s << '##################################################'];
printInfo: [:s | s << ' ' << suite name];
printInfo: [:s | s << ' ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ];
printInfo: [:s | s << '##################################################'].

sortBlock := [:a :b | a class name < b class name or: [a class name = b class name and: [ a selector < b selector ]]].

StdOutPrinter
printLine: [:s | ];
printSuccess: [:s | s << '(' << result passedCount asString << ' tests passed)' ].

(result passed sort: sortBlock)
do: [:test |
currentTestClass = test class name
ifFalse: [
currentTestClass := test class name.
StdOutPrinter
printLine: [:s | ];
printLine: [:s | s << currentTestClass asString ]
].
StdOutPrinter printSuccess: [:s | s << '' << test selector asString ]
].

StdOutPrinter
printLine: [:s | ];
printWarning: [:s | s << '##########################'];
printWarning: [:s | s << ' ' << result failureCount asString << ' tests failed' ];
printWarning: [:s | s << '##########################'].

(result failures sort: sortBlock)
do: [:test |
currentTestClass = test class name
ifFalse: [
currentTestClass := test class name.
StdOutPrinter
printLine: [:s | ];
printLine: [:s | s << currentTestClass asString ]
].
StdOutPrinter printWarning: [:s | s << '' << test selector asString ]
].

StdOutPrinter
printLine: [:s | ];
printError: [:s | s << '##########################'];
printError: [:s | s << ' ' << result errorCount asString << ' tests errored' ];
printError: [:s | s << '##########################'].

(result errors sort: sortBlock)
do: [:test |
currentTestClass = test class name
ifFalse: [
currentTestClass := test class name.
StdOutPrinter
printLine: [:s | ];
printLine: [:s | s << currentTestClass asString ]
].
StdOutPrinter printError: [:s | s << '' << test selector asString ]
].

result hasPassed ifTrue: [
StdOutPrinter
printLine: [:s | ];
printSuccess: [:s | s << '#####################################################'];
printSuccess: [:s | s << '✓ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ];
printSuccess: [:s | s << '#####################################################']
] ifFalse: [
StdOutPrinter
printLine: [:s | ];
printError: [:s | s << '#####################################################'];
printError: [:s | s << '✗ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ];
printError: [:s | s << '#####################################################']
].
result hasPassed
%
91 changes: 3 additions & 88 deletions source/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ echo "Running ${PROJECT_NAME} tests..."

touch "${GEMSTONE_LOG_DIR}/running-tests.log"

echo "Installing stdout printer"
echo "Installing stdout printer & test reporter"

topaz -i -q <<EOF > "${GEMSTONE_LOG_DIR}/installing-stdout-support.log"
set gemstone gs64stone user SystemUser pass ${SYSTEM_USER_PASSWORD}
iferror exit 1
login
input StdOutPrinter.gs
input StdOutTestReporter.gs
commit
logout
exit 0
Expand All @@ -29,93 +30,7 @@ iferror exit 1
login
expectvalue true
doit
| suite result sortBlock currentTestClass |
suite := (Rowan projectNamed: '${PROJECT_NAME}') testSuite.
StdOutPrinter printLine: [:s |
s << 'Running suite ' << suite name << ' with ' << suite tests size asString << ' tests.'.
].
result := suite run.
StdOutPrinter
printLine: [:s | s << '.............'];
printLine: [:s | s << 'Finished running suite: ' << suite name ];
printLine: [:s | ];
printInfo: [:s | s << '##################################################'];
printInfo: [:s | s << ' ' << suite name];
printInfo: [:s | s << ' ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ];
printInfo: [:s | s << '##################################################'].
sortBlock := [:a :b | a class name < b class name or: [a class name = b class name and: [ a selector < b selector ]]].
StdOutPrinter
printLine: [:s | ];
printSuccess: [:s | s << '(' << result passedCount asString << ' tests passed)' ].
(result passed sort: sortBlock)
do: [:test |
currentTestClass = test class name
ifFalse: [
currentTestClass := test class name.
StdOutPrinter
printLine: [:s | ];
printLine: [:s | s << currentTestClass asString ]
].
StdOutPrinter printSuccess: [:s | s << ' ✓ ' << test selector asString ]
].
StdOutPrinter
printLine: [:s | ];
printWarning: [:s | s << '##########################'];
printWarning: [:s | s << ' ' << result failureCount asString << ' tests failed' ];
printWarning: [:s | s << '##########################'].
(result failures sort: sortBlock)
do: [:test |
currentTestClass = test class name
ifFalse: [
currentTestClass := test class name.
StdOutPrinter
printLine: [:s | ];
printLine: [:s | s << currentTestClass asString ]
].
StdOutPrinter printWarning: [:s | s << ' ✗ ' << test selector asString ]
].
StdOutPrinter
printLine: [:s | ];
printError: [:s | s << '##########################'];
printError: [:s | s << ' ' << result errorCount asString << ' tests errored' ];
printError: [:s | s << '##########################'].
(result errors sort: sortBlock)
do: [:test |
currentTestClass = test class name
ifFalse: [
currentTestClass := test class name.
StdOutPrinter
printLine: [:s | ];
printLine: [:s | s << currentTestClass asString ]
].
StdOutPrinter printError: [:s | s << ' ✗ ' << test selector asString ]
].
result hasPassed ifTrue: [
StdOutPrinter
printLine: [:s | ];
printSuccess: [:s | s << '#####################################################'];
printSuccess: [:s | s << '✓ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ];
printSuccess: [:s | s << '#####################################################']
] ifFalse: [
StdOutPrinter
printLine: [:s | ];
printError: [:s | s << '#####################################################'];
printError: [:s | s << '✗ Executed ' << result runCount asString << ' tests with ' << result failureCount asString << ' failures and ' << result errorCount asString << ' errors.' ];
printError: [:s | s << '#####################################################']
].
result hasPassed
StdOutTestReporter new runTestsForProjectNamed: '${PROJECT_NAME}'
%
commit
logout
Expand Down

0 comments on commit 6f2aa31

Please sign in to comment.