@@ -24,11 +24,20 @@ def setUp(self):
2424 CONTAINER_VERSION: $container_version
2525 '''
2626 )
27+ self .fs .create_file (
28+ 'Dockerfile-branch.model' ,
29+ contents = '''
30+ CONTAINER_VERSION: $container_version
31+ RUN apt -y install git
32+ RUN git clone -b $ps_version https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps
33+ '''
34+ )
2735
2836 self .generator = Generator (
2937 '/tmp/images' ,
3038 open ('Dockerfile.model' ).read (),
31- open ('Dockerfile-nightly.model' ).read ()
39+ open ('Dockerfile-nightly.model' ).read (),
40+ open ('Dockerfile-branch.model' ).read ()
3241 )
3342
3443 def test_create_directory (self ):
@@ -92,6 +101,26 @@ def test_generate_nightly_image(self):
92101 self .assertIn ('PS_VERSION: nightly' , content )
93102 self .assertIn ('CONTAINER_VERSION: 7.2-alpine' , content )
94103
104+ def test_generate_branch_image (self ):
105+ dockerfile = '/tmp/images/9.0.x/8.1-alpine/Dockerfile'
106+ self .assertFalse (path .exists (dockerfile ))
107+ self .generator .generate_image (
108+ '9.0.x' ,
109+ '8.1-alpine'
110+ )
111+ self .assertTrue (path .exists (dockerfile ))
112+
113+ with open (dockerfile ) as f :
114+ content = f .read ()
115+ self .assertNotIn (
116+ 'PS_URL' ,
117+ content
118+ )
119+ self .assertNotIn ('PS_VERSION' , content )
120+ self .assertIn ('CONTAINER_VERSION: 8.1-alpine' , content )
121+ self .assertIn ('RUN apt -y install git' , content )
122+ self .assertIn ('RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps' , content )
123+
95124 def test_generate_all (self ):
96125 files = (
97126 '/tmp/images/7.0/7.3-apache/Dockerfile' ,
0 commit comments