mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
Ensure test passes
Signed-off-by: Henke Adolfsson <catears13@gmail.com>
This commit is contained in:
parent
76d0406fab
commit
aa79fb2473
@ -1,6 +1,7 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import copy
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
@ -1500,34 +1501,47 @@ class ProjectTest(DockerClientTestCase):
|
|||||||
def test_project_up_with_added_secrets(self):
|
def test_project_up_with_added_secrets(self):
|
||||||
node = create_host_file(self.client, os.path.abspath('tests/fixtures/secrets/default'))
|
node = create_host_file(self.client, os.path.abspath('tests/fixtures/secrets/default'))
|
||||||
|
|
||||||
config_data = build_config(
|
config_input1 = {
|
||||||
version=V3_1,
|
'version': V3_1,
|
||||||
services=[{
|
'services': [
|
||||||
'name': 'web',
|
{
|
||||||
'image': 'busybox:latest',
|
'name': 'web',
|
||||||
'command': 'cat /run/secrets/special',
|
'image': 'busybox:latest',
|
||||||
# 'secrets': [
|
'command': 'cat /run/secrets/special',
|
||||||
# types.ServiceSecret.parse({'source': 'super', 'target': 'special'}),
|
'environment': ['constraint:node=={}'.format(node if node is not None else '')]
|
||||||
# ],
|
}
|
||||||
'environment': ['constraint:node=={}'.format(node if node is not None else '*')]
|
|
||||||
}],
|
|
||||||
secrets={
|
|
||||||
'super': {
|
|
||||||
'file': os.path.abspath('tests/fixtures/secrets/default'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
],
|
||||||
|
'secrets': {
|
||||||
|
'super': {
|
||||||
|
'file': os.path.abspath('tests/fixtures/secrets/default')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config_input2 = copy.deepcopy(config_input1)
|
||||||
|
# Add the secret
|
||||||
|
config_input2['services'][0]['secrets'] = [
|
||||||
|
types.ServiceSecret.parse({'source': 'super', 'target': 'special'})
|
||||||
|
]
|
||||||
|
|
||||||
|
config_data1 = build_config(**config_input1)
|
||||||
|
config_data2 = build_config(**config_input2)
|
||||||
|
|
||||||
|
# First up with non-secret
|
||||||
project = Project.from_config(
|
project = Project.from_config(
|
||||||
client=self.client,
|
client=self.client,
|
||||||
name='composetest',
|
name='composetest',
|
||||||
config_data=config_data,
|
config_data=config_data1,
|
||||||
)
|
)
|
||||||
project.up()
|
project.up()
|
||||||
project.stop()
|
project.stop()
|
||||||
project.services[0].secrets = [
|
|
||||||
types.ServiceSecret.parse({'source': 'super', 'target': 'special'})
|
# Then up with secret
|
||||||
]
|
project = Project.from_config(
|
||||||
|
client=self.client,
|
||||||
|
name='composetest',
|
||||||
|
config_data=config_data2,
|
||||||
|
)
|
||||||
project.up()
|
project.up()
|
||||||
project.stop()
|
project.stop()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user