From 28592287a381251cdba056fbc712a27a2f76c1c7 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 15 Mar 2021 18:08:25 +0100 Subject: [PATCH] Add a transitive test property This is a minimal reproducer that's essentially A ~> B ~> C. The that_subscribes_to matcher shows that this is equal to A ~> C but in practice Puppet doesn't work that way. The service is not restarted if the file is modified. I don't know what is the expected behavior here, but it does mean that today it's not possible to test for real world behavior. --- spec/classes/relationship__notify_spec.rb | 3 +++ spec/fixtures/modules/relationships/manifests/notify.pp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/spec/classes/relationship__notify_spec.rb b/spec/classes/relationship__notify_spec.rb index c4d4c2f58..274e060e7 100644 --- a/spec/classes/relationship__notify_spec.rb +++ b/spec/classes/relationship__notify_spec.rb @@ -17,4 +17,7 @@ it { should contain_notify('pre').that_notifies(['Notify[post]']) } it { should contain_notify('post').that_subscribes_to(['Notify[pre]']) } + + # TODO: in practice this transitive notification doesn't work + it { should contain_service('myservice').that_subscribes_to('File[/tmp/file.txt]') } end diff --git a/spec/fixtures/modules/relationships/manifests/notify.pp b/spec/fixtures/modules/relationships/manifests/notify.pp index e64da8cce..4de551246 100644 --- a/spec/fixtures/modules/relationships/manifests/notify.pp +++ b/spec/fixtures/modules/relationships/manifests/notify.pp @@ -15,6 +15,10 @@ class { '::relationships::notify::pre': } ~> class { '::relationships::notify::middle': } ~> class { '::relationships::notify::post': } + + file { '/tmp/file.txt': } ~> + file { '/tmp/directory': } ~> + service { 'myservice': } } class relationships::notify::pre {