Skip to content

Commit

Permalink
Remove CentOS7
Browse files Browse the repository at this point in the history
Signed-off-by: Hanwen <[email protected]>
  • Loading branch information
hanwen-cluster committed Jul 12, 2024
1 parent 36961f8 commit c35453c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def mock_already_installed(package, expected_version, installed)
end

for_oses([
%w(centos 7),
%w(redhat 8),
%w(rocky 8),
%w(redhat 9),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,134 +34,6 @@ def self.nothing(chef_run)
end
end

context "on centos 7.4 or lower" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.4"
end
Lustre.setup(runner)
end

it 'can not install lustre' do
is_expected.to write_log("Unsupported version of Centos, 7.4, supported versions are >= 7.5")
.with(level: :warn)
end
end

context "on centos 7.5" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.5"
node.override['cluster']['sources_dir'] = "srcdir"
end
Lustre.setup(runner)
end

it 'installs kmod-lustre-client from downloaded rpm' do
is_expected.to create_if_missing_remote_file("srcdir/kmod-lustre-client-2.10.5.x86_64.rpm")
.with(source: "https://downloads.whamcloud.com/public/lustre/lustre-2.10.5/el7.5.1804/client/RPMS/x86_64/kmod-lustre-client-2.10.5-1.el7.x86_64.rpm")
.with(mode: '0644')
.with(retries: 3)
.with(retry_delay: 5)

is_expected.to install_package('lustre_kmod')
.with(source: "srcdir/kmod-lustre-client-2.10.5.x86_64.rpm")
end

it 'installs lustre-client from downloaded rpm' do
is_expected.to create_if_missing_remote_file("srcdir/lustre-client-2.10.5.x86_64.rpm")
.with(source: "https://downloads.whamcloud.com/public/lustre/lustre-2.10.5/el7.5.1804/client/RPMS/x86_64/lustre-client-2.10.5-1.el7.x86_64.rpm")
.with(mode: '0644')
.with(retries: 3)
.with(retry_delay: 5)

is_expected.to install_package('lustre_client')
.with(source: "srcdir/lustre-client-2.10.5.x86_64.rpm")
end

it 'installs kernel module lnet' do
is_expected.to install_kernel_module("lnet")
end
end

context "on centos 7.6" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.6"
node.override['cluster']['sources_dir'] = "srcdir"
end
Lustre.setup(runner)
end

it 'installs kmod-lustre-client from downloaded rpm' do
is_expected.to create_if_missing_remote_file("srcdir/kmod-lustre-client-2.10.8.x86_64.rpm")
.with(source: "https://downloads.whamcloud.com/public/lustre/lustre-2.10.8/el7/client/RPMS/x86_64/kmod-lustre-client-2.10.8-1.el7.x86_64.rpm")
.with(mode: '0644')
.with(retries: 3)
.with(retry_delay: 5)

is_expected.to install_package('lustre_kmod')
.with(source: "srcdir/kmod-lustre-client-2.10.8.x86_64.rpm")
end

it 'installs lustre-client from downloaded rpm' do
is_expected.to create_if_missing_remote_file("srcdir/lustre-client-2.10.8.x86_64.rpm")
.with(source: "https://downloads.whamcloud.com/public/lustre/lustre-2.10.8/el7/client/RPMS/x86_64/lustre-client-2.10.8-1.el7.x86_64.rpm")
.with(mode: '0644')
.with(retries: 3)
.with(retry_delay: 5)

is_expected.to install_package('lustre_client')
.with(source: "srcdir/lustre-client-2.10.8.x86_64.rpm")
end

it 'installs kernel module lnet' do
is_expected.to install_kernel_module("lnet")
end
end

context "on centos 7.7 or higher" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.7"
end
Lustre.setup(runner)
end

stubs_for_resource('lustre') do |res|
allow(res).to receive(:find_centos_minor_version).and_return('minor')
end

it 'installs lustre packages from repository and installs kernel module lnet' do
is_expected.to create_yum_repository("aws-fsx")
.with(baseurl: 'https://fsx-lustre-client-repo.s3.amazonaws.com/el/7.minor/x86_64/')
.with(gpgkey: 'https://fsx-lustre-client-repo-public-keys.s3.amazonaws.com/fsx-rpm-public-key.asc')
.with(retries: 3)
.with(retry_delay: 5)

is_expected.to run_execute('yum-config-manager_skip_if_unavail')
.with(command: "yum-config-manager --setopt=\*.skip_if_unavailable=1 --save")

is_expected.to install_package(%w(kmod-lustre-client lustre-client dracut))
.with(retries: 3)
.with(retry_delay: 5)

is_expected.to install_kernel_module("lnet")
end
end

[%w(redhat RHEL), ["rocky", "Rocky Linux"]].each do |platform, platform_string|
context "on #{platform} lower than 8.2" do
cached(:chef_run) do
Expand Down Expand Up @@ -290,117 +162,3 @@ def self.nothing(chef_run)
end
end
end

describe 'lustre:find_centos_minor_version' do
context "centos version is not 7" do
cached(:chef_run) do
runner = runner(platform: 'centos', version: '7', step_into: ['lustre']) do |node|
node.automatic['platform_version'] = "8"
end
Lustre.setup(runner)
end

it 'raises error' do
expect { chef_run }.to(raise_error do |error|
expect(error).to be_a(Exception)
# This can not happen because the resource is defined only for Centos7
# expect(error.message).to include("CentOS version 8 not supported")
expect(error.message).to include("Cannot find a resource for lustre on centos version 8")
end)
end
end

context('on centos 7') do
context "kernel release does not match expected format" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.7"
node.override['cluster']['kernel_release'] = 'unexpected.format'
end
Lustre.setup(runner)
end

it 'raises error' do
expect { chef_run }.to(raise_error do |error|
expect(error).to be_a(Exception)
expect(error.message).to include("Unable to retrieve the kernel patch version from unexpected.format.")
end)
end
end

context "kernel release below 3.10.0-1062" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.7"
node.override['cluster']['kernel_release'] = '3.10.0-1061.8.2.el7.x86_64'
end
Lustre.setup(runner)
end

it 'uses empty minor version' do
is_expected.to create_yum_repository("aws-fsx")
.with(baseurl: 'https://fsx-lustre-client-repo.s3.amazonaws.com/el/7./x86_64/')
end
end

context "kernel release 3.10.0-1062 to 3.10.0-1126" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.7"
node.override['cluster']['kernel_release'] = '3.10.0-1062.8.2.el7.x86_64'
end
Lustre.setup(runner)
end

it 'uses minor version 7' do
is_expected.to create_yum_repository("aws-fsx")
.with(baseurl: 'https://fsx-lustre-client-repo.s3.amazonaws.com/el/7.7/x86_64/')
end
end

context "kernel release 3.10.0-1127 to 3.10.0-1167" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.7"
node.override['cluster']['kernel_release'] = '3.10.0-1127.8.2.el7.x86_64'
end
Lustre.setup(runner)
end

it 'uses minor version 7' do
is_expected.to create_yum_repository("aws-fsx")
.with(baseurl: 'https://fsx-lustre-client-repo.s3.amazonaws.com/el/7.8/x86_64/')
end
end

context "kernel from 3.10.0-1168 on" do
cached(:chef_run) do
runner = runner(
platform: 'centos', version: '7',
step_into: ['lustre']
) do |node|
node.automatic['platform_version'] = "7.7"
node.override['cluster']['kernel_release'] = '3.10.0-1168.8.2.el7.x86_64'
end
Lustre.setup(runner)
end

it 'uses minor version 7' do
is_expected.to create_yum_repository("aws-fsx")
.with(baseurl: 'https://fsx-lustre-client-repo.s3.amazonaws.com/el/7.9/x86_64/')
end
end
end
end

0 comments on commit c35453c

Please sign in to comment.