Skip to content

Commit

Permalink
Fix compatibility with updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Feb 28, 2024
1 parent e7ac7ee commit f2db4f9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ StargateConsulExampleTest >> tearDown [
super tearDown
]

{ #category : #tests }
StargateConsulExampleTest >> testApplicationBaselineName [

self assert: StargateConsulExample applicationBaselineName equals: #BaselineOfStargateConsul
]

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

Expand Down Expand Up @@ -105,6 +99,14 @@ ENVIRONMENT
' expandMacrosWith: StargateConsulExample version )
]

{ #category : #tests }
StargateConsulExampleTest >> testProjectName [

self
assert: StargateConsulExample projectName
equals: 'StargateConsul'
]

{ #category : #tests }
StargateConsulExampleTest >> testStart [

Expand Down
12 changes: 6 additions & 6 deletions source/Stargate-Consul-Examples/StargateConsulExample.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ Class {
#category : #'Stargate-Consul-Examples'
}

{ #category : #private }
StargateConsulExample class >> applicationBaselineName [

^ #BaselineOfStargateConsul
]

{ #category : #accessing }
StargateConsulExample class >> commandName [

Expand All @@ -29,6 +23,12 @@ StargateConsulExample class >> initialize [
self initializeVersion
]

{ #category : #private }
StargateConsulExample class >> projectName [

^ 'StargateConsul'
]

{ #category : #'private - accessing' }
StargateConsulExample >> controllersToInstall [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
]

Expand Down Expand Up @@ -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
]

0 comments on commit f2db4f9

Please sign in to comment.