add tests for names and listen/listen_in

Closes #30115
This commit is contained in:
Daniel Wallace 2018-03-05 11:36:38 -07:00
parent 3f8e0db572
commit d6d9e36359
No known key found for this signature in database
GPG key ID: 5FA5E5544F010D48
3 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,11 @@
test:
test.succeed_with_changes:
- name: test
- listen_in:
- test: service
service:
test.succeed_without_changes:
- names:
- nginx
- crond

View file

@ -0,0 +1,11 @@
test:
test.succeed_with_changes:
- name: test
service:
test.succeed_without_changes:
- names:
- nginx
- crond
- listen:
- test: test

View file

@ -1156,6 +1156,28 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
listener_state = 'cmd_|-listener_test_listening_resolution_two_|-echo "Successful listen resolution"_|-mod_watch'
self.assertIn(listener_state, state_run)
def test_listen_in_requisite_resolution_names(self):
'''
Verify listen_in requisite lookups use ID declaration to check for changes
and resolves magic names state variable
'''
# Only run the state once and keep the return data
state_run = self.run_function('state.sls', mods='requisites.listen_in_names')
self.assertIn('test_|-listener_service_|-nginx_|-mod_watch', state_run)
self.assertIn('test_|-listener_service_|-crond_|-mod_watch', state_run)
def test_listen_requisite_resolution_names(self):
'''
Verify listen requisite lookups use ID declaration to check for changes
and resolves magic names state variable
'''
# Only run the state once and keep the return data
state_run = self.run_function('state.sls', mods='requisites.listen_names')
self.assertIn('test_|-listener_service_|-nginx_|-mod_watch', state_run)
self.assertIn('test_|-listener_service_|-crond_|-mod_watch', state_run)
def test_issue_30820_requisite_in_match_by_name(self):
'''
This tests the case where a requisite_in matches by name instead of ID