From 52d061563b2273701d5868335183e772b5cb74f1 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Thu, 9 Jan 2025 16:54:48 +0100 Subject: [PATCH] added missing test for the provider --- spec/acceptance/key_value.rb | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/spec/acceptance/key_value.rb b/spec/acceptance/key_value.rb index fec3c0c..ee0a929 100644 --- a/spec/acceptance/key_value.rb +++ b/spec/acceptance/key_value.rb @@ -1,3 +1,46 @@ # frozen_string_literal: true require 'spec_helper_acceptance' + +describe 'nomad class' do + context 'server with nomad_key_value declarations' do + # failing on purpose on missing directories + pp = <<-MANIFEST + class { 'nomad': + config_hash => { + datacenter => 'ptk', + data_dir => "/var/lib/nomad", + extra_options => '-dev', + server => { + enabled => false, + bootstrap_expect => 1, + } + }, + 'acl' => { + 'enabled' => false + }, + 'client' => { + 'enabled' => false, + } + } + nomad_key_value { 'test/foo': + require => Class['nomad'], + value => { + 'key1' => 'value1', + 'key2' => 'value2', + }, + } + nomad_key_value { 'test/bar': + ensure => absent; + require => Class['nomad'], + value => { + 'key1' => 'value10', + }, + } + MANIFEST + + # Run it twice and test for idempotency + apply_manifest(pp, expect_failures: true) + apply_manifest(pp, catch_changes: true) + end +end