From 874f5b36900f6f073e89122ab43a90625cc5097c Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Mon, 22 Apr 2024 17:08:28 -0300 Subject: [PATCH] Use Launchpad testing affordances --- .../BaselineOfStargateConsul.class.st | 20 +++++----- source/BaselineOfStargateConsul/package.st | 2 +- .../StargateConsulExampleTest.class.st | 39 ++----------------- 3 files changed, 15 insertions(+), 46 deletions(-) diff --git a/source/BaselineOfStargateConsul/BaselineOfStargateConsul.class.st b/source/BaselineOfStargateConsul/BaselineOfStargateConsul.class.st index fd5ac3e..05629ab 100644 --- a/source/BaselineOfStargateConsul/BaselineOfStargateConsul.class.st +++ b/source/BaselineOfStargateConsul/BaselineOfStargateConsul.class.st @@ -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 [ @@ -20,13 +21,13 @@ BaselineOfStargateConsul >> baseline: spec [ ] ] -{ #category : #accessing } +{ #category : 'accessing' } BaselineOfStargateConsul >> projectClass [ ^ MetacelloCypressBaselineProject ] -{ #category : #baselines } +{ #category : 'baselines' } BaselineOfStargateConsul >> setUpDependencies: spec [ spec @@ -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 @@ -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' ] diff --git a/source/BaselineOfStargateConsul/package.st b/source/BaselineOfStargateConsul/package.st index a510088..06efe64 100644 --- a/source/BaselineOfStargateConsul/package.st +++ b/source/BaselineOfStargateConsul/package.st @@ -1 +1 @@ -Package { #name : #BaselineOfStargateConsul } +Package { #name : 'BaselineOfStargateConsul' } diff --git a/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st b/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st index 1759469..d02a3fc 100644 --- a/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st +++ b/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st @@ -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 [ @@ -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 [ @@ -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' } @@ -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' ]