mirror of
https://github.com/docker/compose.git
synced 2025-05-03 06:00:13 +02:00
Test self referencing 'file'
When specifying the 'file' key to a value of it's own name, test that this works and does not cause a false positive circular reference error. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
6a6e7934bd
commit
c6e03d739d
16
tests/fixtures/extends/specify-file-as-self.yml
vendored
Normal file
16
tests/fixtures/extends/specify-file-as-self.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
myweb:
|
||||||
|
extends:
|
||||||
|
file: specify-file-as-self.yml
|
||||||
|
service: web
|
||||||
|
environment:
|
||||||
|
- "BAR=1"
|
||||||
|
web:
|
||||||
|
extends:
|
||||||
|
file: specify-file-as-self.yml
|
||||||
|
service: otherweb
|
||||||
|
image: busybox
|
||||||
|
environment:
|
||||||
|
- "BAZ=3"
|
||||||
|
otherweb:
|
||||||
|
environment:
|
||||||
|
- "YEP=1"
|
@ -413,6 +413,33 @@ class ExtendsTest(unittest.TestCase):
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def test_self_referencing_file(self):
|
||||||
|
"""
|
||||||
|
We specify a 'file' key that is the filename we're already in.
|
||||||
|
"""
|
||||||
|
service_dicts = load_from_filename('tests/fixtures/extends/specify-file-as-self.yml')
|
||||||
|
self.assertEqual(service_dicts, [
|
||||||
|
{
|
||||||
|
'environment':
|
||||||
|
{
|
||||||
|
'YEP': '1', 'BAR': '1', 'BAZ': '3'
|
||||||
|
},
|
||||||
|
'image': 'busybox',
|
||||||
|
'name': 'myweb'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'environment':
|
||||||
|
{'YEP': '1'},
|
||||||
|
'name': 'otherweb'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'environment':
|
||||||
|
{'YEP': '1', 'BAZ': '3'},
|
||||||
|
'image': 'busybox',
|
||||||
|
'name': 'web'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
def test_circular(self):
|
def test_circular(self):
|
||||||
try:
|
try:
|
||||||
load_from_filename('tests/fixtures/extends/circle-1.yml')
|
load_from_filename('tests/fixtures/extends/circle-1.yml')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user