Skip to content

Allow for testing that certain relationships aren't associated with a particular resource #605

Open
@ITBlogger

Description

@ITBlogger

Often we need to do logic where resources notify, subscribe, come before or require other resources under certain conditions, but DO NOT do the same in other conditions. Currently, it's not possible to test whether a given resource does not have a particular relationship with another, we can only test that relationships exist.

Please add the functionality to allow for testing that relationships do not exist for a given resource.

An example: We have 'production' and 'maintenance' modes of operation for systems:

class foo (
  Enum['production', 'maintenance'] $operating_mode,
) {

  if $operating_mode == 'maintenance' {
    File {
      owner => '0',
    }
  } else {
    File {
      owner => '0',
      notify  => Service['bar'],
    }
  }

  file { '/some/file':
    ensure => file,
  }

  service { 'bar':
    ensure => running,
  }
}

Should be able to have two rspec contexts 'production' and 'maintenance' and in maintenance context test that file '/some/file' does not notify service 'bar'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions