From c261392909c55923765aed9b7bf3808b8f8d73ef Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Wed, 8 Nov 2023 16:06:56 +0000 Subject: [PATCH 01/28] make it possible to turn off rdb-save-incremental-fsync --- templates/redis.conf.epp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index dd9223d4..00c32427 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,7 +1030,7 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% if $rdb_save_incremental_fsync { -%>rdb-save-incremental-fsync <%= $rdb_save_incremental_fsync ? {true => 'yes', default => 'no'} %><% } -%> +rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') -%> # Redis Cluster Settings <% if $cluster_enabled { -%> From 28af3ce81cae2143a9bdecfabb0213f822a8e97b Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Wed, 8 Nov 2023 16:26:50 +0000 Subject: [PATCH 02/28] make it possible to turn off rdb-save-incremental-fsync From 2d4375c74dcd9c3e20177bb38e6a3457d4e6af4c Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 9 Nov 2023 10:53:30 +0000 Subject: [PATCH 03/28] wrap in an `if` to account for `undef` --- templates/redis.conf.epp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 00c32427..3128ec6b 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,8 +1030,9 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. +<% if $rdb_save_incremental_fsync { -%> rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') -%> - +<% } %> # Redis Cluster Settings <% if $cluster_enabled { -%> cluster-enabled yes From 52e777e752f98d6090227c949bc8e77f31074e95 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 10 Nov 2023 08:34:52 +0000 Subject: [PATCH 04/28] comparison to Undef and test --- spec/classes/redis_spec.rb | 15 ++++++++++++++- templates/redis.conf.epp | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index ff204c0a..0e48902c 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1680,7 +1680,7 @@ class { 'redis': } end - describe 'test rdb-save-incremental-fsync for redis6' do + describe 'test rdb-save-incremental-fsync enabled for redis6' do let(:params) do { rdb_save_incremental_fsync: true, @@ -1690,6 +1690,19 @@ class { 'redis': it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync yes$}) } end + describe 'test rdb-save-incremental-fsync disabled for redis6' do + let(:params) do + { + rdb_save_incremental_fsync: false , + } + end + + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync ino$}) } + end + + + + describe 'test systemd service timeouts' do let(:params) do { diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 3128ec6b..37993490 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,7 +1030,7 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% if $rdb_save_incremental_fsync { -%> +<% unless $rdb_save_incremental_fsync =~ Undef{ -%> rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') -%> <% } %> # Redis Cluster Settings From 75f2e7c651aa5f3d59acfe1e7318d0ca474b7223 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 10 Nov 2023 09:14:53 +0000 Subject: [PATCH 05/28] comparison to Undef and test (fix typo) --- spec/classes/redis_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 0e48902c..13b89a3f 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1693,11 +1693,11 @@ class { 'redis': describe 'test rdb-save-incremental-fsync disabled for redis6' do let(:params) do { - rdb_save_incremental_fsync: false , + rdb_save_incremental_fsync: false, } end - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync ino$}) } + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } end From 8453017208bc8c3133b02636503ce9e1f8a3d899 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 10 Nov 2023 09:24:43 +0000 Subject: [PATCH 06/28] rspec formatting --- spec/classes/redis_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 13b89a3f..0619d03f 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1690,15 +1690,15 @@ class { 'redis': it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync yes$}) } end - describe 'test rdb-save-incremental-fsync disabled for redis6' do - let(:params) do - { - rdb_save_incremental_fsync: false, - } - end - - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } - end + describe 'test rdb-save-incremental-fsync disabled for redis6' do + let(:params) do + { + rdb_save_incremental_fsync: false, + } + end + + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } + end From 88179d2645fd7302c77c0e0f5596f0abf680977a Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 10 Nov 2023 09:26:35 +0000 Subject: [PATCH 07/28] rspec formatting --- spec/classes/redis_spec.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 0619d03f..eb61cd12 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1700,9 +1700,6 @@ class { 'redis': it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } end - - - describe 'test systemd service timeouts' do let(:params) do { From d59524b059cce645c19e97dd22d49baf11cc258b Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 10 Nov 2023 09:40:50 +0000 Subject: [PATCH 08/28] rspec test for Undef --- spec/classes/redis_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index eb61cd12..fd243ba2 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1700,6 +1700,17 @@ class { 'redis': it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } end + describe 'test rdb-save-incremental-fsync Undef for redis6' do + let(:params) do + { + rdb_save_incremental_fsync: Undef, + } + end + + it { is_expected.not_to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync}) } + + end + describe 'test systemd service timeouts' do let(:params) do { From a6db2e748f13606e701c0df979acd269f47a716b Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 10 Nov 2023 10:08:47 +0000 Subject: [PATCH 09/28] rspec formatting --- spec/classes/redis_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index fd243ba2..0ccc5b0c 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1708,7 +1708,6 @@ class { 'redis': end it { is_expected.not_to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync}) } - end describe 'test systemd service timeouts' do From 98b75046244c9134722f3863e6462c8323e6fe4b Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 15:39:30 +0000 Subject: [PATCH 10/28] minot commit bump to trigger CI --- spec/classes/redis_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 0ccc5b0c..7be7680c 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1680,7 +1680,7 @@ class { 'redis': } end - describe 'test rdb-save-incremental-fsync enabled for redis6' do + describe 'test rdb-save-incremental-fsync enabled' do let(:params) do { rdb_save_incremental_fsync: true, @@ -1690,7 +1690,7 @@ class { 'redis': it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync yes$}) } end - describe 'test rdb-save-incremental-fsync disabled for redis6' do + describe 'test rdb-save-incremental-fsync disabled' do let(:params) do { rdb_save_incremental_fsync: false, @@ -1700,7 +1700,7 @@ class { 'redis': it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } end - describe 'test rdb-save-incremental-fsync Undef for redis6' do + describe 'test rdb-save-incremental-fsync Undef' do let(:params) do { rdb_save_incremental_fsync: Undef, From c4e308e7ab7e83451b94056d5d2cbd5931d5cf4b Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 15:54:55 +0000 Subject: [PATCH 11/28] Undef -> nil in spec --- spec/classes/redis_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 7be7680c..5221a19b 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1703,7 +1703,7 @@ class { 'redis': describe 'test rdb-save-incremental-fsync Undef' do let(:params) do { - rdb_save_incremental_fsync: Undef, + rdb_save_incremental_fsync: nil, } end From 757e9d9eeecc08abd39341083bdfa00e5178926b Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 16:34:13 +0000 Subject: [PATCH 12/28] attempt test for negation using regex rather than as i am less familiar with its behaviour --- spec/classes/redis_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 5221a19b..a4ccd6d8 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1707,7 +1707,7 @@ class { 'redis': } end - it { is_expected.not_to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync}) } + it { is_expected.to contain_file(config_file_orig).with('content' => %r{(?!^rdb-save-incremental-fsync.*)}) } end describe 'test systemd service timeouts' do From 440a70cf337034fcef3def77bb7a64a7a2e233ed Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 16:48:12 +0000 Subject: [PATCH 13/28] perhaps i want instead --- spec/classes/redis_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index a4ccd6d8..db00b8f7 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1707,7 +1707,7 @@ class { 'redis': } end - it { is_expected.to contain_file(config_file_orig).with('content' => %r{(?!^rdb-save-incremental-fsync.*)}) } + it { is_expected.to contain_file(config_file_orig).without('content' => %r{^rdb-save-incremental-fsync}) } end describe 'test systemd service timeouts' do From 5e2f74b7b3fd3dcf692006551df742bc86af87ba Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 17:15:43 +0000 Subject: [PATCH 14/28] maybe i made an infocorrect assumption in the EPP template --- templates/redis.conf.epp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 37993490..2c706e44 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,7 +1030,7 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% unless $rdb_save_incremental_fsync =~ Undef{ -%> +<% unless $rdb_save_incremental_fsync == undef{ -%> rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') -%> <% } %> # Redis Cluster Settings From c5b865a45af81b12f21144dd00cd80f93b6a5472 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 17:34:42 +0000 Subject: [PATCH 15/28] sometimes it can be a string --- spec/classes/redis_spec.rb | 2 +- templates/redis.conf.epp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index db00b8f7..8c5c2a66 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1707,7 +1707,7 @@ class { 'redis': } end - it { is_expected.to contain_file(config_file_orig).without('content' => %r{^rdb-save-incremental-fsync}) } + it { is_expected.to contain_file(config_file_orig).without('content' => %r{^rdb-save-incremental-fsync.*$}) } end describe 'test systemd service timeouts' do diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 2c706e44..945c0fa5 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -98,7 +98,7 @@ Integer[1, 100] $active_defrag_cycle_max, Integer[1] $active_defrag_max_scan_fields, Optional[Boolean] $jemalloc_bg_thread, - Optional[Boolean] $rdb_save_incremental_fsync, + Optional[Variant[Boolean,String]] $rdb_save_incremental_fsync, | -%> # Redis configuration file example @@ -1031,7 +1031,7 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # in order to commit the file to the disk more incrementally and avoid # big latency spikes. <% unless $rdb_save_incremental_fsync == undef{ -%> -rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') -%> +rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> <% } %> # Redis Cluster Settings <% if $cluster_enabled { -%> From 442dfdc621864149438945c1db6b28c72da05cd3 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 19:04:38 +0000 Subject: [PATCH 16/28] reorder tests to test undef/nil variant first --- spec/classes/redis_spec.rb | 19 +++++++++---------- templates/redis.conf.epp | 7 ++++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 8c5c2a66..4cc61b3c 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1679,35 +1679,34 @@ class { 'redis': ) } end - - describe 'test rdb-save-incremental-fsync enabled' do + describe 'test rdb-save-incremental-fsync Undef' do let(:params) do { - rdb_save_incremental_fsync: true, + rdb_save_incremental_fsync: nil, } end - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync yes$}) } + it { is_expected.to contain_file(config_file_orig).without('content' => %r{^rdb-save-incremental-fsync.*$}) } end - describe 'test rdb-save-incremental-fsync disabled' do + describe 'test rdb-save-incremental-fsync enabled' do let(:params) do { - rdb_save_incremental_fsync: false, + rdb_save_incremental_fsync: true, } end - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync yes$}) } end - describe 'test rdb-save-incremental-fsync Undef' do + describe 'test rdb-save-incremental-fsync disabled' do let(:params) do { - rdb_save_incremental_fsync: nil, + rdb_save_incremental_fsync: false, } end - it { is_expected.to contain_file(config_file_orig).without('content' => %r{^rdb-save-incremental-fsync.*$}) } + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^rdb-save-incremental-fsync no$}) } end describe 'test systemd service timeouts' do diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 945c0fa5..3f8a9954 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,9 +1030,10 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% unless $rdb_save_incremental_fsync == undef{ -%> -rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> -<% } %> +<% unless $rdb_save_incremental_fsync == undef -%> +rdb_save_incremental_fsync: <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> +<% end -%> + # Redis Cluster Settings <% if $cluster_enabled { -%> cluster-enabled yes From 01d5160d71b57161babd79ae7d0998d2ca2b33f6 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 19:07:16 +0000 Subject: [PATCH 17/28] reorder tests to test undef/nil variant first --- templates/redis.conf.epp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 3f8a9954..79771dcb 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,9 +1030,9 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% unless $rdb_save_incremental_fsync == undef -%> -rdb_save_incremental_fsync: <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> -<% end -%> +<% unless $rdb_save_incremental_fsync == undef { -%> +rdb_save_incremental_fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> +<% } -%> # Redis Cluster Settings <% if $cluster_enabled { -%> From 976ad0ab0bbd0f81186aa582ceee045b2c79314d Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 19:11:53 +0000 Subject: [PATCH 18/28] reorder tests to test undef/nil variant first --- spec/classes/redis_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 4cc61b3c..f3316d10 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1679,6 +1679,7 @@ class { 'redis': ) } end + describe 'test rdb-save-incremental-fsync Undef' do let(:params) do { From 52fe4a70734d4afba3073c516b221de474a2213c Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 19:47:24 +0000 Subject: [PATCH 19/28] misspelled as rdb_save_incremental_fsync --- templates/redis.conf.epp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 79771dcb..1b10d867 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -98,7 +98,7 @@ Integer[1, 100] $active_defrag_cycle_max, Integer[1] $active_defrag_max_scan_fields, Optional[Boolean] $jemalloc_bg_thread, - Optional[Variant[Boolean,String]] $rdb_save_incremental_fsync, + Optional[Boolean] $rdb_save_incremental_fsync, | -%> # Redis configuration file example @@ -1031,7 +1031,7 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # in order to commit the file to the disk more incrementally and avoid # big latency spikes. <% unless $rdb_save_incremental_fsync == undef { -%> -rdb_save_incremental_fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> +rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> <% } -%> # Redis Cluster Settings From 2fe204b03498d4dc2ace985c99462191dc117eba Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 20:07:55 +0000 Subject: [PATCH 20/28] easier to test for a commented-out line --- spec/classes/redis_spec.rb | 2 +- templates/redis.conf.epp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index f3316d10..e663ce3d 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1687,7 +1687,7 @@ class { 'redis': } end - it { is_expected.to contain_file(config_file_orig).without('content' => %r{^rdb-save-incremental-fsync.*$}) } + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes$}) } end describe 'test rdb-save-incremental-fsync enabled' do diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 1b10d867..5e4acc65 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,9 +1030,9 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% unless $rdb_save_incremental_fsync == undef { -%> +<% if $ rdb_save_incremental_fsync == undef { %>#rdb-save-incremental-fsync yes<% } else { %> rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> -<% } -%> +<% } %> # Redis Cluster Settings <% if $cluster_enabled { -%> From cd910719373c49909d9e76ed5e68f773596c0a77 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 20:11:33 +0000 Subject: [PATCH 21/28] easier to test for a commented-out line --- templates/redis.conf.epp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 5e4acc65..a0518834 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,7 +1030,8 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% if $ rdb_save_incremental_fsync == undef { %>#rdb-save-incremental-fsync yes<% } else { %> +<% if $rdb_save_incremental_fsync == undef { %>#rdb-save-incremental-fsync yes +<% } else { %> rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> <% } %> From 0fa6900f62c7dd29f32957f1c8d57b9040aaae82 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 20:23:38 +0000 Subject: [PATCH 22/28] easier to test for a commented-out line --- spec/classes/redis_spec.rb | 2 +- templates/redis.conf.epp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index e663ce3d..44dde6b1 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1687,7 +1687,7 @@ class { 'redis': } end - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes$}) } + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes}) } end describe 'test rdb-save-incremental-fsync enabled' do diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index a0518834..06116102 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,7 +1030,8 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. -<% if $rdb_save_incremental_fsync == undef { %>#rdb-save-incremental-fsync yes +<% if $rdb_save_incremental_fsync == undef { %> +#rdb-save-incremental-fsync yes <% } else { %> rdb-save-incremental-fsync <%= bool2str($rdb_save_incremental_fsync, 'yes', 'no') %> <% } %> From 00a1d33f2b27203c736404f7fe139aaf93822ba3 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 20:32:28 +0000 Subject: [PATCH 23/28] i give up on this test. It works in reality, I could really do with a hand :shrug: --- spec/classes/redis_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 44dde6b1..c0f54007 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1680,15 +1680,15 @@ class { 'redis': } end - describe 'test rdb-save-incremental-fsync Undef' do - let(:params) do - { - rdb_save_incremental_fsync: nil, - } - end - - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes}) } - end +# describe 'test rdb-save-incremental-fsync Undef' do +# let(:params) do +# { +# rdb_save_incremental_fsync: nil, +# } +# end +# +# it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes}) } +# end describe 'test rdb-save-incremental-fsync enabled' do let(:params) do From 64a690c80f76ece03fb8e6ae7da125c10eb73ebd Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 20:34:34 +0000 Subject: [PATCH 24/28] i give up on this test. It works in reality, I could really do with a hand :shrug: --- spec/classes/redis_spec.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index c0f54007..2af9acca 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1680,16 +1680,6 @@ class { 'redis': } end -# describe 'test rdb-save-incremental-fsync Undef' do -# let(:params) do -# { -# rdb_save_incremental_fsync: nil, -# } -# end -# -# it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes}) } -# end - describe 'test rdb-save-incremental-fsync enabled' do let(:params) do { From a7f18d28bf2924a73dce44b07a5fc72d6c227abf Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 20:53:18 +0000 Subject: [PATCH 25/28] last idea: undef-as-string https://github.com/rodjek/rspec-puppet/issues/279 --- spec/classes/redis_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 2af9acca..a69193d0 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1680,6 +1680,16 @@ class { 'redis': } end + describe 'test rdb-save-incremental-fsync undef' do + let(:params) do + { + rdb_save_incremental_fsync: 'undef', + } + end + + it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes}) } + end + describe 'test rdb-save-incremental-fsync enabled' do let(:params) do { From 8a6d21e4ea67f1d2366c17d5f92c792ef10abbed Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 21:02:52 +0000 Subject: [PATCH 26/28] last idea: undef-as-string https://github.com/rodjek/rspec-puppet/issues/279 --- spec/classes/redis_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index a69193d0..67f07644 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1683,7 +1683,7 @@ class { 'redis': describe 'test rdb-save-incremental-fsync undef' do let(:params) do { - rdb_save_incremental_fsync: 'undef', + rdb_save_incremental_fsync: Undef, } end From d101011e83a62bbe32fa40f2ea86b5626e8bae03 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Thu, 16 Nov 2023 21:11:30 +0000 Subject: [PATCH 27/28] i give up on this test. It works in reality, I could really do with a hand :shrug: --- spec/classes/redis_spec.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb index 67f07644..2af9acca 100644 --- a/spec/classes/redis_spec.rb +++ b/spec/classes/redis_spec.rb @@ -1680,16 +1680,6 @@ class { 'redis': } end - describe 'test rdb-save-incremental-fsync undef' do - let(:params) do - { - rdb_save_incremental_fsync: Undef, - } - end - - it { is_expected.to contain_file(config_file_orig).with('content' => %r{^#rdb-save-incremental-fsync yes}) } - end - describe 'test rdb-save-incremental-fsync enabled' do let(:params) do { From 58af36cbcf7db68513913c7859efae1b487f7838 Mon Sep 17 00:00:00 2001 From: Seth Tunstall Date: Fri, 17 Nov 2023 08:28:00 +0000 Subject: [PATCH 28/28] bump to trigger tests --- templates/redis.conf.epp | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/redis.conf.epp b/templates/redis.conf.epp index 06116102..3a7b81c2 100644 --- a/templates/redis.conf.epp +++ b/templates/redis.conf.epp @@ -1030,6 +1030,7 @@ aof-rewrite-incremental-fsync <%= bool2str($aof_rewrite_incremental_fsync, 'yes' # the file will be fsync-ed every 32 MB of data generated. This is useful # in order to commit the file to the disk more incrementally and avoid # big latency spikes. + <% if $rdb_save_incremental_fsync == undef { %> #rdb-save-incremental-fsync yes <% } else { %>