1. ์งํ ์ํฉ
๊ธฐ๋ฅ ์ฝ๋ ์์ ์ดํ, ๋ฒ๊ทธ ์ฌํ ๋ฐ ํด๋น ํด๊ฒฐ ์ฝ๋์ ๋ํ ํ
์คํธ ์ฝ๋๋ฅผ ์ถ๊ฐํด๋ฌ๋ผ๋ ์์ฒญ์ ๋ฐ์
์ด์ ๋ฐ๋ผ ๊ธฐ์กด ํ
์คํธ ์ฝ๋(test_configuration.py)์ ์๋ ํ
์คํธ ์ฝ๋๋ฅผ 2๊ฐ์ ํจ์๋ก ๋ถํ ํจ
@mock.patch("keystoneauth1.loading.base.get_plugin_options",
return_value=opts)
def test_show_mask_with_cloud_config(self, m_get_plugin_opts):
arglist = ['--mask']
verifylist = [('mask', True)]
self.app.client_manager.configuration_type = "cloud_config"
cmd = configuration.ShowConfiguration(self.app, None)
parsed_args = self.check_parser(cmd, arglist, verifylist)
columns, data = cmd.take_action(parsed_args)
self.assertEqual(self.columns, columns)
self.assertEqual(self.datalist, data)
@mock.patch("keystoneauth1.loading.base.get_plugin_options",
return_value=opts)
def test_show_mask_with_global_env(self, m_get_plugin_opts):
arglist = ['--mask']
verifylist = [('mask', True)]
self.app.client_manager.configuration_type = "global_env"
column_list = (
'identity_api_version',
'password',
'region',
'token',
'username'
)
datalist = (
fakes.VERSION,
configuration.REDACTED,
fakes.REGION_NAME,
configuration.REDACTED,
fakes.USERNAME,
)
cmd = configuration.ShowConfiguration(self.app, None)
parsed_args = self.check_parser(cmd, arglist, verifylist)
columns, data = cmd.take_action(parsed_args)
self.assertEqual(column_list, columns)
self.assertEqual(datalist, data)
--mask ์ต์
์ ๊ธฐ๋ณธ์ ์ผ๋ก cloud_config ์ต์
์ ๊ธฐ๋ณธ์ผ๋ก ์ ์ฉํ๋ ์ํฉ์ด ํ
์คํธ ์ฝ๋์ ๊ตฌํ๋์ด ์์๊ณ (devstack CI ํ
์คํธ ์ผ์ด์ค ๋ฑ์์ ํ์ธ), global_env ์ํฉ์ ๋ํ ํ
์คํธ ์ฝ๋๊ฐ ์๋ ์ํฉ์ด์์ (์คํ๋๋ ๊ธฐ๋ฅ๋ ํด๋น ์ฝ๋๋ง ๋น ์ ธ ์์์)
๋ฐ๋ผ์ ํ
์คํธ ์ฝ๋๋ฅผ ๊ตฌํํ๊ณ , ํ
์คํธ ์ฝ๋์ ์ ์ฉ๋๋ fake auth ์ธ์ฆ ๊ฐ๋ค์ ์์ ๊ตฌ์กฐ์ ๋ฐ๋ผ ๋ณ๊ฒฝ ์์
์ ์งํ
def __init__(self):
self.compute = None
self.identity = None
self.image = None
self.object_store = None
self.volume = None
self.network = None
self.session = None
self.auth_ref = None
self.auth_plugin_name = None
self.network_endpoint_enabled = True
self.compute_endpoint_enabled = True
self.volume_endpoint_enabled = True
self.configuration_type = "cloud_config" # ๋ด๊ฐ ์ถ๊ฐํ ์ฝ๋
def get_configuration(self): # ๊ธฐ์กด ํจ์ ๋ณ๊ฒฝ -> config ๋์
๋๋ฆฌ๋ฅผ cloud_config or global_env์ ๋ฐ๋ผ ์
๋ ฅ๋ณ์ ๋ณ๊ฒฝ
config = {
'region': REGION_NAME,
'identity_api_version': VERSION,
}
if self.configuration_type == "cloud_config":
config["auth"] = {
'username': USERNAME,
'password': PASSWORD,
'token': AUTH_TOKEN,
}
elif self.configuration_type == "global_env":
config["username"] = USERNAME
config["password"] = PASSWORD
config["token"] = AUTH_TOKEN
return config
ํ
์คํธ ์ฝ๋๋ฅผ ์คํํ ๋ ๋ชฉ์
๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ์ด์ ๊ฐ์ fakes.py๋ฅผ ์ ์ ํ๊ฒ ๋ณ๊ฒฝํด์ฃผ๋ ๊ฒ์ด ์ค์ํ๊ณ ๋์ ํ configuration.py์์ ํ
์คํธ ํ์ผ๋ก ๋ณ๊ฒฝ ๊ฐ์ ์ ๋ฌํด์ค ์ ์๋ ๋ฐฉ๋ฒ์ด ๋ ์ค๋ฅด์ง ์์์ ์์ ๊ฐ์ ์ฝ๋ ๊ตฌ์กฐ๋ฅผ ์ ์ฉํ์
2. ๊ฒฐ๊ณผ
๋คํํ๋ Zuul CI์์ ์๋ฌ ๋ฐ์ ์์ด ์ปค๋ฐ์ด ๋์์
์ด์ maintainer์ ์ ํ
์คํธ ์ฝ๋์ ๋ํ ๋ต๋ณ์ ๋๊ธฐ ์ค์