Michael P.
Michael P.

Reputation: 43

Using a defined type of an yet unreleased puppet module

We are currently developing three puppet modules. One contains a Defined Type which the other two shall use. This module, lets call it ModuleA, is not released yet into our local forge/repository and will not until it was successfully implemented and tested in at least one of the other two modules (company procedure).

The Definded Type is used in the other two modules to create a resource and is referenced via 'include'. In the metadata.json ModuleA is added as dependency.

When I run pdk test unit it fails because the Defined Type is unknown. Currently there is only a single it { is_expected.to compile.with_all_deps } test in the other two modules, nothing complex.

How can the other two modules be tested if ModuleA is not released yet?

Upvotes: 0

Views: 67

Answers (1)

John Bollinger
John Bollinger

Reputation: 180998

How can the other two modules be tested if ModuleA is not released yet?

Your tests for the other modules can provide stub implementations of the required defined type. This can be done with a :pre_condition:

describe 'Module_b::Some_class' do
  let(:pre_condition) { 'define module_a::some_type($param1, $param2) { }' }

  # ...
end

Do be sure that the number and names of the stub match those of the real defined type.

Upvotes: 0

Related Questions