Skip to content

Commit

Permalink
Merge pull request #36 from ba-st/use_launchpad_testing
Browse files Browse the repository at this point in the history
Use Launchpad testing affordances
  • Loading branch information
gcotelli authored Apr 22, 2024
2 parents e46aa57 + 874f5b3 commit 7c640a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 46 deletions.
20 changes: 11 additions & 9 deletions source/BaselineOfStargateConsul/BaselineOfStargateConsul.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #BaselineOfStargateConsul,
#superclass : #BaselineOf,
#category : #BaselineOfStargateConsul
#name : 'BaselineOfStargateConsul',
#superclass : 'BaselineOf',
#category : 'BaselineOfStargateConsul',
#package : 'BaselineOfStargateConsul'
}

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfStargateConsul >> baseline: spec [

<baseline>
Expand All @@ -20,13 +21,13 @@ BaselineOfStargateConsul >> baseline: spec [
]
]

{ #category : #accessing }
{ #category : 'accessing' }
BaselineOfStargateConsul >> projectClass [

^ MetacelloCypressBaselineProject
]

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfStargateConsul >> setUpDependencies: spec [

spec
Expand All @@ -37,14 +38,15 @@ BaselineOfStargateConsul >> setUpDependencies: spec [

spec
baseline: 'Launchpad' with: [ spec repository: 'github://ba-st/Launchpad:v5' ];
project: 'Launchpad-Deployment' copyFrom: 'Launchpad' with: [ spec loads: 'Deployment' ].
project: 'Launchpad-Deployment' copyFrom: 'Launchpad' with: [ spec loads: 'Deployment' ];
project: 'Launchpad-SUnit' copyFrom: 'Launchpad' with: [ spec loads: 'Dependent-SUnit-Extensions' ].

spec
baseline: 'Superluminal' with: [ spec repository: 'github://ba-st/Superluminal:v5' ];
project: 'Superluminal-API-Client' copyFrom: 'Superluminal' with: [ spec loads: 'API Client' ]
]

{ #category : #baselines }
{ #category : 'baselines' }
BaselineOfStargateConsul >> setUpPackages: spec [

spec
Expand All @@ -63,6 +65,6 @@ BaselineOfStargateConsul >> setUpPackages: spec [

spec
package: 'Stargate-Consul-Examples-Tests'
with: [ spec requires: #( 'Stargate-Consul-Examples' 'Stargate-SUnit' ) ];
with: [ spec requires: #( 'Stargate-Consul-Examples' 'Stargate-SUnit' 'Launchpad-SUnit' ) ];
group: 'Tests' with: 'Stargate-Consul-Examples-Tests'
]
2 changes: 1 addition & 1 deletion source/BaselineOfStargateConsul/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfStargateConsul }
Package { #name : 'BaselineOfStargateConsul' }
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,14 @@ A StargateConsulExampleTest is a test class for testing the behavior of Stargate
"
Class {
#name : 'StargateConsulExampleTest',
#superclass : 'TestCase',
#superclass : 'LaunchpadTest',
#instVars : [
'application',
'port'
],
#category : 'Stargate-Consul-Examples-Tests',
#package : 'Stargate-Consul-Examples-Tests'
}

{ #category : 'running' }
StargateConsulExampleTest >> runCase [

self shouldnt: [ super runCase ] raise: Exit
]

{ #category : 'running' }
StargateConsulExampleTest >> setUp [

Expand All @@ -26,32 +19,6 @@ StargateConsulExampleTest >> setUp [
StargateConsulExample logsDirectory ensureCreateDirectory
]

{ #category : 'running' }
StargateConsulExampleTest >> start: aLaunchpadApplication withAll: arguments [

String streamContents: [ :stream |
| context rootCommand |

rootCommand := LaunchpadRootCommand new.
context := LaunchpadCommandLineProcessingContext
handling: ( CommandLineArguments withArguments: {
'launchpad'.
'start'.
aLaunchpadApplication commandName } , arguments )
writingTo: stream.
self assert: ( rootCommand canHandle: ( context nextCommandLineArgumentIfNone: [ self fail ] ) ).
rootCommand evaluateWithin: context.
application := LaunchpadApplication currentlyRunning
]
]

{ #category : 'running' }
StargateConsulExampleTest >> tearDown [

application ifNotNil: [ application stop ].
super tearDown
]

{ #category : 'tests' }
StargateConsulExampleTest >> testDefaultServiceDiscoveryTimeSlotBetweenRetries [

Expand All @@ -61,7 +28,7 @@ StargateConsulExampleTest >> testDefaultServiceDiscoveryTimeSlotBetweenRetries [
'--stargate.operations-secret=secret'.
'--stargate.consul-agent-location=' }.

self assert: application serviceDiscoveryTimeSlotBetweenRetries equals: 100 milliSeconds
self assert: runningApplication serviceDiscoveryTimeSlotBetweenRetries equals: 100 milliSeconds
]

{ #category : 'tests' }
Expand Down Expand Up @@ -96,7 +63,7 @@ StargateConsulExampleTest >> testStart [
response := ZnClient new
beOneShot;
enforceHttpSuccess: true;
get: application configuration stargate publicURL / 'echo' / 'hello'.
get: runningApplication configuration stargate publicURL / 'echo' / 'hello'.

self assert: response equals: 'HELLO'
]

0 comments on commit 7c640a6

Please sign in to comment.