@@ -722,7 +722,32 @@ def test_can_generate_random_node_key_when_not_imported(self):
722
722
723
723
# region configure_docker
724
724
725
- def _assert_can_configure_docker (self , config , expected_startup_files , expected_service_names ):
725
+ def _assert_can_configure_docker (self , config , expected_startup_files , expected_service_names , expected_recovery_service_names ):
726
+ def _assert_can_configure_service (docker_compose_filepath , expected_names ):
727
+ # - check compose file
728
+ expected_image_map = {
729
+ 'db' : 'mongo:7.0.16' ,
730
+ 'initiate' : 'mongo:7.0.16' ,
731
+ 'client' : 'symbolplatform/symbol-server:gcc-a.b.c.d' ,
732
+ 'broker' : 'symbolplatform/symbol-server:gcc-a.b.c.d' ,
733
+ 'rest-api' : 'symbolplatform/symbol-rest:a.b.c' ,
734
+ 'rest-api-https-proxy' : 'steveltn/https-portal:1'
735
+ }
736
+
737
+ service_names = []
738
+ with open (docker_compose_filepath , 'rt' , encoding = 'utf8' ) as infile :
739
+ compose_config = yaml .safe_load (infile )
740
+ for service_name in compose_config ['services' ]:
741
+ service = compose_config ['services' ][service_name ]
742
+ if 'rest-api-https-proxy' != service_name :
743
+ self .assertEqual ('2222:3333' , service ['user' ])
744
+
745
+ self .assertEqual (expected_image_map [service_name ], service ['image' ])
746
+
747
+ service_names .append (service_name )
748
+
749
+ self .assertEqual (expected_names , service_names )
750
+
726
751
# Arrange:
727
752
with tempfile .TemporaryDirectory () as output_directory :
728
753
with Preparer (output_directory , config ) as preparer :
@@ -747,60 +772,45 @@ def _assert_can_configure_docker(self, config, expected_startup_files, expected_
747
772
else :
748
773
self .assertFalse (preparer .directories .startup .exists ())
749
774
750
- # - check compose file
751
- expected_image_map = {
752
- 'db' : 'mongo:7.0.16' ,
753
- 'initiate' : 'mongo:7.0.16' ,
754
- 'client' : 'symbolplatform/symbol-server:gcc-a.b.c.d' ,
755
- 'broker' : 'symbolplatform/symbol-server:gcc-a.b.c.d' ,
756
- 'rest-api' : 'symbolplatform/symbol-rest:a.b.c' ,
757
- 'rest-api-https-proxy' : 'steveltn/https-portal:1'
758
- }
759
-
760
775
compose_filepath = Path (output_directory ) / 'docker-compose.yaml'
761
776
assert 0o400 == compose_filepath .stat ().st_mode & 0o777
777
+ _assert_can_configure_service (compose_filepath , expected_service_names )
762
778
763
- service_names = []
764
- with open (compose_filepath , 'rt' , encoding = 'utf8' ) as infile :
765
- compose_config = yaml .safe_load (infile )
766
- for service_name in compose_config ['services' ]:
767
- service = compose_config ['services' ][service_name ]
768
- if 'rest-api-https-proxy' != service_name :
769
- self .assertEqual ('2222:3333' , service ['user' ])
770
-
771
- self .assertEqual (expected_image_map [service_name ], service ['image' ])
772
-
773
- service_names .append (service_name )
774
-
775
- self .assertEqual (expected_service_names , service_names )
779
+ recovery_compose_filepath = Path (output_directory ) / 'docker-compose-recovery.yaml'
780
+ assert 0o400 == recovery_compose_filepath .stat ().st_mode & 0o777
781
+ _assert_can_configure_service (recovery_compose_filepath , expected_recovery_service_names )
776
782
777
783
def test_can_configure_docker_peer_node (self ):
778
784
config = self ._create_configuration (NodeFeatures .PEER )
779
- self ._assert_can_configure_docker (config , None , ['client' ])
785
+ self ._assert_can_configure_docker (config , None , ['client' ], [ 'client' ] )
780
786
781
787
def test_can_configure_docker_api_node_with_https (self ):
782
788
config = self ._create_configuration (NodeFeatures .API )
783
789
self ._assert_can_configure_docker (config , [
784
- 'delayrestapi.sh' , 'mongors.sh' , 'startBroker.sh' , 'startServer.sh' , 'wait.sh'
790
+ 'delayrestapi.sh' , 'mongors.sh' , 'startBroker.sh' , 'startRecovery.sh' , ' startServer.sh' , 'wait.sh'
785
791
], [
786
792
'db' , 'initiate' , 'client' , 'broker' , 'rest-api' , 'rest-api-https-proxy'
793
+ ], [
794
+ 'db' , 'initiate' , 'client'
787
795
])
788
796
789
797
def test_can_configure_docker_api_node_without_https (self ):
790
798
config = self ._create_configuration (NodeFeatures .API , api_https = False )
791
799
self ._assert_can_configure_docker (config , [
792
- 'delayrestapi.sh' , 'mongors.sh' , 'startBroker.sh' , 'startServer.sh' , 'wait.sh'
800
+ 'delayrestapi.sh' , 'mongors.sh' , 'startBroker.sh' , 'startRecovery.sh' , ' startServer.sh' , 'wait.sh'
793
801
], [
794
802
'db' , 'initiate' , 'client' , 'broker' , 'rest-api'
803
+ ], [
804
+ 'db' , 'initiate' , 'client'
795
805
])
796
806
797
807
def test_can_configure_docker_api_light_node_with_https (self ):
798
808
config = self ._create_configuration (NodeFeatures .API , light_api = True )
799
- self ._assert_can_configure_docker (config , [], ['client' , 'rest-api' , 'rest-api-https-proxy' ])
809
+ self ._assert_can_configure_docker (config , [], ['client' , 'rest-api' , 'rest-api-https-proxy' ], [ 'client' ] )
800
810
801
811
def test_can_configure_docker_api_light_node_without_https (self ):
802
812
config = self ._create_configuration (NodeFeatures .API , api_https = False , light_api = True )
803
- self ._assert_can_configure_docker (config , [], ['client' , 'rest-api' ])
813
+ self ._assert_can_configure_docker (config , [], ['client' , 'rest-api' ], [ 'client' ] )
804
814
805
815
# endregion
806
816
0 commit comments