mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #44190 from prymitive/postgres_extension
Fix test=true checks so that state runs in test mode don't report cha…
This commit is contained in:
commit
c46490c183
@ -121,14 +121,15 @@ def present(name,
|
||||
if flag in mtdata:
|
||||
toupgrade = True
|
||||
mode = 'upgrade'
|
||||
if __opts__['test']:
|
||||
ret['result'] = None
|
||||
if mode:
|
||||
ret['comment'] = 'Extension {0} is set to be {1}ed'.format(
|
||||
name, mode).replace('eed', 'ed')
|
||||
return ret
|
||||
cret = None
|
||||
if toinstall or toupgrade:
|
||||
if __opts__['test']:
|
||||
ret['result'] = None
|
||||
if mode:
|
||||
ret['comment'] = 'Extension {0} is set to be {1}ed'.format(
|
||||
name, mode).replace('eed', 'ed')
|
||||
return ret
|
||||
|
||||
cret = __salt__['postgres.create_extension'](
|
||||
name=name,
|
||||
if_not_exists=if_not_exists,
|
||||
|
@ -422,8 +422,8 @@ class PostgresExtensionTestCase(TestCase, LoaderModuleMockMixin):
|
||||
ret = postgres_extension.present('foo')
|
||||
self.assertEqual(
|
||||
ret,
|
||||
{'comment': "Extension foo is set to be created",
|
||||
'changes': {}, 'name': 'foo', 'result': None}
|
||||
{'comment': "Extension foo is already present",
|
||||
'changes': {}, 'name': 'foo', 'result': True}
|
||||
|
||||
)
|
||||
ret = postgres_extension.present('foo')
|
||||
|
@ -45,8 +45,8 @@ class PostgresExtensionTestCase(TestCase, LoaderModuleMockMixin):
|
||||
with patch.dict(postgres_extension.__salt__,
|
||||
{'postgres.create_metadata': mock}):
|
||||
with patch.dict(postgres_extension.__opts__, {'test': True}):
|
||||
comt = ('Extension {0} is set to be created'.format(name))
|
||||
ret.update({'comment': comt, 'result': None})
|
||||
comt = ('Extension {0} is already present'.format(name))
|
||||
ret.update({'comment': comt, 'result': True})
|
||||
self.assertDictEqual(postgres_extension.present(name), ret)
|
||||
|
||||
with patch.dict(postgres_extension.__opts__, {'test': False}):
|
||||
|
Loading…
Reference in New Issue
Block a user