diff --git a/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st b/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st index 1cbb8e8..d304a4b 100644 --- a/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st +++ b/source/Stargate-Consul-Examples-Tests/StargateConsulExampleTest.class.st @@ -51,12 +51,6 @@ StargateConsulExampleTest >> tearDown [ super tearDown ] -{ #category : #tests } -StargateConsulExampleTest >> testApplicationBaselineName [ - - self assert: StargateConsulExample applicationBaselineName equals: #BaselineOfStargateConsul -] - { #category : #tests } StargateConsulExampleTest >> testDefaultServiceDiscoveryTimeSlotBetweenRetries [ @@ -105,6 +99,14 @@ ENVIRONMENT ' expandMacrosWith: StargateConsulExample version ) ] +{ #category : #tests } +StargateConsulExampleTest >> testProjectName [ + + self + assert: StargateConsulExample projectName + equals: 'StargateConsul' +] + { #category : #tests } StargateConsulExampleTest >> testStart [ diff --git a/source/Stargate-Consul-Examples/StargateConsulExample.class.st b/source/Stargate-Consul-Examples/StargateConsulExample.class.st index e590663..4c065f8 100644 --- a/source/Stargate-Consul-Examples/StargateConsulExample.class.st +++ b/source/Stargate-Consul-Examples/StargateConsulExample.class.st @@ -4,12 +4,6 @@ Class { #category : #'Stargate-Consul-Examples' } -{ #category : #private } -StargateConsulExample class >> applicationBaselineName [ - - ^ #BaselineOfStargateConsul -] - { #category : #accessing } StargateConsulExample class >> commandName [ @@ -29,6 +23,12 @@ StargateConsulExample class >> initialize [ self initializeVersion ] +{ #category : #private } +StargateConsulExample class >> projectName [ + + ^ 'StargateConsul' +] + { #category : #'private - accessing' } StargateConsulExample >> controllersToInstall [ diff --git a/source/Stargate-Consul-Tests/ConsulAgentDockerBasedCheckTest.class.st b/source/Stargate-Consul-Tests/ConsulAgentDockerBasedCheckTest.class.st index 6468795..6ceba1e 100644 --- a/source/Stargate-Consul-Tests/ConsulAgentDockerBasedCheckTest.class.st +++ b/source/Stargate-Consul-Tests/ConsulAgentDockerBasedCheckTest.class.st @@ -11,20 +11,22 @@ Class { ConsulAgentDockerBasedCheckTest >> testAsJSON [ | check json | - check := ConsulAgentDockerBasedCheck - named: 'Check memory' - executing: '/bin/bash' - withArguments: #('/usr/local/bin/check-memory.sh') - inContainer: 'f972c95ebf0e' - every: 10 seconds. + named: 'Check memory' + executing: '/bin/bash' + withArguments: #( '/usr/local/bin/check-memory.sh' ) + inContainer: 'f972c95ebf0e' + every: 10 seconds. - json := NeoJSONObject fromString: ( NeoJSONWriter toStringPretty: check ). + json := NeoJSONObject fromString: + (NeoJSONWriter toStringPretty: check). self assert: json Name equals: 'Check memory'; assert: json Shell equals: '/bin/bash'; - assert: json Args equals: #('/usr/local/bin/check-memory.sh'); + withTheOnlyOneIn: json Args + do: [ :arg | + self assert: arg equals: '/usr/local/bin/check-memory.sh' ]; assert: json DockerContainerID equals: 'f972c95ebf0e'; assert: json Interval equals: '10s' ] diff --git a/source/Stargate-Consul-Tests/ConsulAgentHTTPBasedCheckTest.class.st b/source/Stargate-Consul-Tests/ConsulAgentHTTPBasedCheckTest.class.st index 83727d8..5d0308b 100644 --- a/source/Stargate-Consul-Tests/ConsulAgentHTTPBasedCheckTest.class.st +++ b/source/Stargate-Consul-Tests/ConsulAgentHTTPBasedCheckTest.class.st @@ -35,21 +35,22 @@ ConsulAgentHTTPBasedCheckTest >> testAsJSON [ ConsulAgentHTTPBasedCheckTest >> testAsJSONWhenHeadersArePresent [ | check json | - check := ConsulAgentHTTPBasedCheck - named: 'HTTP check' - executing: #POST - against: 'http://api.example.com' asUrl - withHeaders: { #accept -> ZnMimeType applicationJson } - every: 10 seconds - timeoutAfter: 1.5 minutes. + named: 'HTTP check' + executing: #POST + against: 'http://api.example.com' asUrl + withHeaders: { #accept -> ZnMimeType applicationJson } + every: 10 seconds + timeoutAfter: 1.5 minutes. - json := NeoJSONObject fromString: ( NeoJSONWriter toStringPretty: check ). + json := NeoJSONObject fromString: + (NeoJSONWriter toStringPretty: check). self assert: json Name equals: 'HTTP check'; assert: json Method equals: 'POST'; - assert: json Header accept equals: #('application/json'); + withTheOnlyOneIn: json Header accept + do: [ :header | self assert: header equals: 'application/json' ]; assert: json HTTP equals: 'http://api.example.com/'; assert: json Timeout equals: '1m30s'; assert: json Interval equals: '10s' diff --git a/source/Stargate-Consul/ConsulAwareStargateApplication.class.st b/source/Stargate-Consul/ConsulAwareStargateApplication.class.st index 3631c23..cb4c754 100644 --- a/source/Stargate-Consul/ConsulAwareStargateApplication.class.st +++ b/source/Stargate-Consul/ConsulAwareStargateApplication.class.st @@ -118,7 +118,7 @@ ConsulAwareStargateApplication >> healthCheckToken [ jws payload: ( JWTClaimsSet new permissions: #( 'execute:health-check' ); yourself ). - jws key: self stargateConfiguration operationsSecret. + jws symmetricKey: self stargateConfiguration operationsSecret. ^ jws compactSerialized ] @@ -162,8 +162,10 @@ ConsulAwareStargateApplication >> serviceDiscoveryTimeSlotBetweenRetries [ { #category : #'private - building' } ConsulAwareStargateApplication >> withDockerHostnameDo: aFoundBlock ifAbsent: aNotFoundBlock [ - "Inside Docker containers the HOSTNAME variable holds the container id" - ^ OSEnvironment current at: 'HOSTNAME' ifPresent: aFoundBlock ifAbsent: aNotFoundBlock + ^ LanguagePlatform current os + environmentAt: 'HOSTNAME' + ifPresent: aFoundBlock + ifAbsent: aNotFoundBlock ]