Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
fix: update rubies for ruby-nq and fullstack, set default ruby to 2.7
Browse files Browse the repository at this point in the history
Fixes #266
  • Loading branch information
ajgon committed Oct 8, 2021
1 parent 4887cf5 commit 09ba7e1
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 115 deletions.
3 changes: 2 additions & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ suites:
- recipe[opsworks_ruby::setup]
- recipe[opsworks_ruby::deploy]
attributes:
'ruby-version': '2.6'
deploy:
dummy_project:
framework:
Expand Down Expand Up @@ -220,4 +221,4 @@ suites:
webserver:
adapter: 'apache2'
port: 8081
'ruby-version': '2.6'
'ruby-version': '2.7'
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# ruby
default['apt']['compile_time_update'] = true
default['build-essential']['compile_time'] = true
default['ruby-version'] = node['ruby'].try(:[], 'version') || '2.6'
default['ruby-version'] = node['ruby'].try(:[], 'version') || '2.7'
default['ruby-provider'] = 'ruby-ng'
default['nginx']['source']['modules'] = %w[
nginx::http_ssl_module nginx::http_realip_module nginx::http_gzip_static_module nginx::headers_more_module
Expand Down
2 changes: 1 addition & 1 deletion docs/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ They should'nt be used under `node['deploy'][<application_shortname>]` (notice l
(for example `ruby-ng` gets freshest versions of ruby way earlier than Amazon Linux).

- **Type:** string
- **Default:** `2.6`
- **Default:** `3.0`
- Sets the Ruby version used through the system. For debian-based distributions, a `ruby-ng` cookbook is used
(check [ruby-ng cookbook documentation](https://supermarket.chef.io/cookbooks/ruby-ng)).
For Amazon Linux, packages provided by distribution (i.e. `ruby23`, `ruby23-devel` etc.).
Expand Down
240 changes: 133 additions & 107 deletions spec/unit/recipes/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@
end

it 'installs ruby 2.6' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.6' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
end.converge(described_recipe)

expect(chef_run).to install_package('fullstaq-ruby-2.6')
end

Expand All @@ -200,6 +207,52 @@
expect(chef_run).to install_package('fullstaq-ruby-2.6-jemalloc')
end

it 'installs ruby 2.7' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.7' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
end.converge(described_recipe)

expect(chef_run).to install_package('fullstaq-ruby-2.7')
end

it 'installs ruby 2.7 with variant' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.7' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
solo_node.set['ruby-variant'] = 'jemalloc'
end.converge(described_recipe)

expect(chef_run).to install_package('fullstaq-ruby-2.7-jemalloc')
end

it 'installs ruby 3.0' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '3.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
end.converge(described_recipe)

expect(chef_run).to install_package('fullstaq-ruby-3.0')
end

it 'installs ruby 3.0 with variant' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '3.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
solo_node.set['ruby-variant'] = 'jemalloc'
end.converge(described_recipe)

expect(chef_run).to install_package('fullstaq-ruby-3.0-jemalloc')
end

it 'adds fullstaq apt repository' do
keyurl = 'https://raw.githubusercontent.com/fullstaq-labs/fullstaq-ruby-server-edition/main/fullstaq-ruby.asc'

Expand Down Expand Up @@ -252,6 +305,13 @@
end

it 'installs ruby 2.6' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.6' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('fullstaq-ruby-2.6')
end

Expand All @@ -267,6 +327,52 @@
expect(chef_run_rhel).to install_package('fullstaq-ruby-2.6-jemalloc')
end

it 'installs ruby 2.7' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.7' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('fullstaq-ruby-2.7')
end

it 'installs ruby 2.7 with variant' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.7' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
solo_node.set['ruby-variant'] = 'jemalloc'
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('fullstaq-ruby-2.7-jemalloc')
end

it 'installs ruby 3.0' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '3.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('fullstaq-ruby-3.0')
end

it 'installs ruby 3.0 with variant' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '3.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
solo_node.set['ruby-provider'] = 'fullstaq'
solo_node.set['ruby-variant'] = 'jemalloc'
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('fullstaq-ruby-3.0-jemalloc')
end

it 'adds fullstaq yum repository' do
expect(chef_run_rhel).to create_yum_repository('fullstaq-ruby').with(
baseurl: 'https://yum.fullstaqruby.org/centos-7/$basearch',
Expand All @@ -283,156 +389,76 @@
context 'Rubies' do
context 'Debian' do
context 'ruby-ng' do
it 'installs ruby 2.0' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.0')
expect(chef_run).to install_package('ruby2.0-dev')
end

it 'installs ruby 2.1' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.1' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.1')
expect(chef_run).to install_package('ruby2.1-dev')
end

it 'installs ruby 2.2' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.2' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.2')
expect(chef_run).to install_package('ruby2.2-dev')
end

it 'installs ruby 2.3' do
it 'installs ruby 2.5' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.3' }
solo_node.set['ruby'] = { 'version' => '2.5' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.3')
expect(chef_run).to install_package('ruby2.3-dev')
expect(chef_run).to install_package('ruby2.5')
expect(chef_run).to install_package('ruby2.5-dev')
end

it 'installs ruby 2.4' do
it 'installs ruby 2.6' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.4' }
solo_node.set['ruby'] = { 'version' => '2.6' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.4')
expect(chef_run).to install_package('ruby2.4-dev')
expect(chef_run).to install_package('ruby2.6')
expect(chef_run).to install_package('ruby2.6-dev')
end

it 'installs ruby 2.5' do
it 'installs ruby 2.7' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.5' }
solo_node.set['ruby'] = { 'version' => '2.7' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.5')
expect(chef_run).to install_package('ruby2.5-dev')
end

it 'installs ruby 2.6' do
expect(chef_run).to install_package('ruby2.6')
expect(chef_run).to install_package('ruby2.6-dev')
expect(chef_run).to install_package('ruby2.7')
expect(chef_run).to install_package('ruby2.7-dev')
end
end
end

context 'rhel' do
it 'installs ruby 2.0' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby20')
expect(chef_run_rhel).to install_package('ruby20-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.0')
end

it 'installs ruby 2.1' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.1' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby21')
expect(chef_run_rhel).to install_package('ruby21-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.1')
end

it 'installs ruby 2.2' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.2' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby22')
expect(chef_run_rhel).to install_package('ruby22-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.2')
end

it 'installs ruby 2.3' do
it 'installs ruby 2.5' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.3' }
solo_node.set['ruby'] = { 'version' => '2.5' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby23')
expect(chef_run_rhel).to install_package('ruby23-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.3')
expect(chef_run_rhel).to install_package('ruby25')
expect(chef_run_rhel).to install_package('ruby25-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.5')
end

it 'installs ruby 2.4' do
it 'installs ruby 2.6' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.4' }
solo_node.set['ruby'] = { 'version' => '2.6' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby24')
expect(chef_run_rhel).to install_package('ruby24-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.4')
expect(chef_run_rhel).to install_package('ruby26')
expect(chef_run_rhel).to install_package('ruby26-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.6')
end

it 'installs ruby 2.5' do
it 'installs ruby 2.7' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.5' }
solo_node.set['ruby'] = { 'version' => '2.7' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby25')
expect(chef_run_rhel).to install_package('ruby25-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.5')
end

it 'installs ruby 2.6' do
expect(chef_run_rhel).to install_package('ruby26')
expect(chef_run_rhel).to install_package('ruby26-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.6')
expect(chef_run_rhel).to install_package('ruby27')
expect(chef_run_rhel).to install_package('ruby27-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.7')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.6') do
describe package('ruby2.7') do
it { should be_installed }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/default/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.6') do
describe package('ruby2.7') do
it { should be_installed }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.6') do
describe package('ruby2.7') do
it { should be_installed }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/nullified/serverspec/nullified_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.6') do
describe package('ruby2.7') do
it { should be_installed }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.6') do
describe package('ruby2.7') do
it { should be_installed }
end

Expand Down

0 comments on commit 09ba7e1

Please sign in to comment.