From f432cfd3b2ff77954c695fe66908a45611888bd8 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Mon, 27 May 2024 15:24:58 +0100 Subject: [PATCH 1/4] chef should be enabled --- spec/services/chef_spec.rb | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/spec/services/chef_spec.rb b/spec/services/chef_spec.rb index a908e80..d7c743a 100644 --- a/spec/services/chef_spec.rb +++ b/spec/services/chef_spec.rb @@ -28,10 +28,10 @@ end end -service_status = command("systemctl is-enabled #{service}").stdout -service_status = service_status.strip +# service_status = command("systemctl is-enabled #{service}").stdout +# service_status = service_status.strip -if service_status == 'enabled' +# if service_status == 'enabled' describe "Checking #{service_status} service for #{service}..." do describe service(service) do it { should be_enabled } @@ -61,21 +61,21 @@ end end end -end +# end -if service_status == 'disabled' - describe "Checking #{service_status} service for #{service}..." do - describe service(service) do - it { should_not be_enabled } - it { should_not be_running } - end +# if service_status == 'disabled' +# describe "Checking #{service_status} service for #{service}..." do +# describe service(service) do +# it { should_not be_enabled } +# it { should_not be_running } +# end - describe file(config_file) do - it { should_not exist } - end +# describe file(config_file) do +# it { should_not exist } +# end - describe port(port) do - it { should_not be_listening } - end - end -end +# describe port(port) do +# it { should_not be_listening } +# end +# end +# end From 5f6d811b3cfe382b3814777f795f6fae4d140ccf Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Mon, 27 May 2024 15:42:43 +0100 Subject: [PATCH 2/4] fix compile error --- spec/services/chef_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/services/chef_spec.rb b/spec/services/chef_spec.rb index d7c743a..99af251 100644 --- a/spec/services/chef_spec.rb +++ b/spec/services/chef_spec.rb @@ -32,7 +32,7 @@ # service_status = service_status.strip # if service_status == 'enabled' - describe "Checking #{service_status} service for #{service}..." do + describe "Checking service_status service for #{service}..." do describe service(service) do it { should be_enabled } it { should be_running } From 1bff8657be4468aaa613027cde59e69520b94e57 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Wed, 29 May 2024 12:52:07 +0100 Subject: [PATCH 3/4] Squashed commit of the following: commit a1d18815c84fdfdbec6f759b5253cff55a95ee99 Author: Luis Blanco Date: Wed May 29 12:48:49 2024 +0100 clean commented code commit fcbd0f9388e2c90db185be2a1e41d00adcf2106f Merge: f432cfd 3d333a1 Author: Luis Blanco Date: Mon May 27 15:38:07 2024 +0100 Merge branch 'feature/add_ed25519_support' into bugfix/by_default_chef_should_be_up_and_running commit 3d333a13521953c0c168585818ac572e3ea42bcf Author: Luis Blanco Date: Mon May 27 13:43:25 2024 +0100 gemfile update --- Gemfile | 2 ++ spec/services/chef_spec.rb | 68 +++++++++++++------------------------- 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/Gemfile b/Gemfile index 8f05c4f..f508390 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,5 @@ gem 'highline' gem 'colorize' gem "rake" gem 'rubocop', '>= 1.57.2' +gem 'ed25519', '>= 1.2' +gem 'bcrypt_pbkdf', '>= 1.0' \ No newline at end of file diff --git a/spec/services/chef_spec.rb b/spec/services/chef_spec.rb index 99af251..f3acbe9 100644 --- a/spec/services/chef_spec.rb +++ b/spec/services/chef_spec.rb @@ -28,54 +28,32 @@ end end -# service_status = command("systemctl is-enabled #{service}").stdout -# service_status = service_status.strip - -# if service_status == 'enabled' - describe "Checking service_status service for #{service}..." do - describe service(service) do - it { should be_enabled } - it { should be_running } - end +describe "Checking service_status for #{service}..." do + describe service(service) do + it { should be_enabled } + it { should be_running } + end - describe file(config_file) do - it { should exist } - it { should be_file } - end + describe file(config_file) do + it { should exist } + it { should be_file } + end - describe port(port) do - it { should be_listening } - end + describe port(port) do + it { should be_listening } + end - describe 'Registered in consul' do - service_json_cluster = command("curl -s #{api_endpoint}/catalog/service/#{serv_consul} | jq -c 'group_by(.ID)[]'") - service_json_cluster = service_json_cluster.stdout.chomp.split("\n") - health_cluster = command("curl -s #{api_endpoint}/health/service/#{serv_consul} | jq -r '.[].Checks[0].Status'") - health_cluster = health_cluster.stdout.chomp.split("\n") - service_and_health = service_json_cluster.zip(health_cluster) - service_and_health.each do |service, health| - registered = JSON.parse(service)[0].key?('Address') && health == 'passing' # ? true : false - it 'Should be registered and enabled' do - expect(registered).to be true - end + describe 'Registered in consul' do + service_json_cluster = command("curl -s #{api_endpoint}/catalog/service/#{serv_consul} | jq -c 'group_by(.ID)[]'") + service_json_cluster = service_json_cluster.stdout.chomp.split("\n") + health_cluster = command("curl -s #{api_endpoint}/health/service/#{serv_consul} | jq -r '.[].Checks[0].Status'") + health_cluster = health_cluster.stdout.chomp.split("\n") + service_and_health = service_json_cluster.zip(health_cluster) + service_and_health.each do |service, health| + registered = JSON.parse(service)[0].key?('Address') && health == 'passing' # ? true : false + it 'Should be registered and enabled' do + expect(registered).to be true end end end -# end - -# if service_status == 'disabled' -# describe "Checking #{service_status} service for #{service}..." do -# describe service(service) do -# it { should_not be_enabled } -# it { should_not be_running } -# end - -# describe file(config_file) do -# it { should_not exist } -# end - -# describe port(port) do -# it { should_not be_listening } -# end -# end -# end +end From 3b7ff8340590d155b5fe09bbe931de56ea7b9788 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Mon, 24 Jun 2024 14:15:13 +0100 Subject: [PATCH 4/4] lint confusing variable name --- spec/services/chef_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/services/chef_spec.rb b/spec/services/chef_spec.rb index f3acbe9..4e25af6 100644 --- a/spec/services/chef_spec.rb +++ b/spec/services/chef_spec.rb @@ -49,8 +49,8 @@ health_cluster = command("curl -s #{api_endpoint}/health/service/#{serv_consul} | jq -r '.[].Checks[0].Status'") health_cluster = health_cluster.stdout.chomp.split("\n") service_and_health = service_json_cluster.zip(health_cluster) - service_and_health.each do |service, health| - registered = JSON.parse(service)[0].key?('Address') && health == 'passing' # ? true : false + service_and_health.each do |sv, health| + registered = JSON.parse(sv)[0].key?('Address') && health == 'passing' # ? true : false it 'Should be registered and enabled' do expect(registered).to be true end