Commit 072a1402 authored by Seth Thomas's avatar Seth Thomas
Browse files

Bats->InSpec, fixes, and updates


Signed-off-by: default avatarSeth Thomas <sthomas@chef.io>
parent e3ebbf12
......@@ -11,8 +11,7 @@ provisioner:
name: dokken
verifier:
root_path: '/opt/verifier'
sudo: false
name: inspec
platforms:
- name: debian-7
......@@ -90,9 +89,9 @@ platforms:
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which net-tools
- name: opensuse-42.1
- name: opensuse-42.2
driver:
image: opensuse:42.1
image: opensuse:42.2
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which hostname
......@@ -114,6 +113,11 @@ suites:
- name: esl
run_list:
- recipe[erlang::esl]
excludes:
- centos-5
- fedora-latest
- opensuse-13.2
- opensuse-42.2
- name: source
run_list:
......
......@@ -45,6 +45,9 @@ suites:
- recipe[erlang::esl]
excludes:
- centos-5.11
- fedora-25
- opensuse-13.2
- opensuse-42.2
- name: source
run_list:
......
......@@ -10,6 +10,8 @@ Manages installation of Erlang via packages or source.
- Debian/Ubuntu
- RHEL/CentOS/Scientific/Amazon/Oracle
- Fedora
- openSUSE
### Chef
......
......@@ -21,8 +21,8 @@
default['erlang']['gui_tools'] = false
default['erlang']['install_method'] = 'package'
default['erlang']['source']['version'] = '18.3'
default['erlang']['source']['checksum'] = 'fdab8129a1cb935db09f1832e3a7d511a4aeb2b9bb3602ca6a7ccb9730d5c9c3'
default['erlang']['source']['version'] = '19.2'
default['erlang']['source']['checksum'] = 'a016b3ef5dac1e532972617b2715ef187ecb616f7cd7ddcfe0f1d502f5d24870'
default['erlang']['source']['build_flags'] = ''
default['erlang']['source']['cflags'] = ''
......
......@@ -21,6 +21,8 @@
case node['platform_family']
when 'debian'
package 'apt-transport-https'
apt_repository 'erlang_solutions_repo' do
uri 'https://packages.erlang-solutions.com/debian/'
distribution node['erlang']['esl']['lsb_codename']
......
......@@ -27,7 +27,7 @@ when 'debian'
package erlpkg
package 'erlang-dev'
when 'rhel'
when 'rhel', 'suse', 'fedora'
if node['platform_version'].to_i == 5
Chef::Log.warn('Adding EPEL Erlang Repo. This will have SSL verification disabled, as')
Chef::Log.warn('RHEL/CentOS 5.x will not be able to verify the SSL certificate of this')
......@@ -43,6 +43,6 @@ when 'rhel'
end
end
include_recipe 'yum-epel'
include_recipe 'yum-epel' if node['platform_family'] == 'rhel'
package 'erlang'
end
......@@ -27,6 +27,8 @@ when 'debian'
package %w(tar libncurses5-dev openssl libssl-dev)
when 'rhel', 'fedora'
package %w(tar ncurses-devel openssl-devel)
when 'suse'
package %w(tar ncurses-devel libopenssl-devel)
end
erlang_version = node['erlang']['source']['version']
......@@ -35,6 +37,12 @@ erlang_checksum = node['erlang']['source']['checksum']
erlang_build_flags = node['erlang']['source']['build_flags']
erlang_cflags = node['erlang']['source']['cflags']
if erlang_version =~ /R\d*B\d*/
ver_check = "erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell"
else
ver_check = "erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), erlang:display(erlang:binary_to_list(Version)), halt().' -noshell"
end
bash 'install-erlang' do
cwd Chef::Config[:file_cache_path]
code <<-EOH
......@@ -43,7 +51,7 @@ bash 'install-erlang' do
EOH
environment('CFLAGS' => erlang_cflags)
action :nothing
not_if "erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), erlang:display(erlang:binary_to_list(Version)), halt().' -noshell | grep #{erlang_version}"
not_if "#{ver_check} | grep #{erlang_version}"
end
remote_file File.join(Chef::Config[:file_cache_path], "otp_src_#{erlang_version}.tar.gz") do
......
@test "run an erl command" {
sudo bash -c 'erl -myflag 1 <<-EOH
init:get_argument(myflag).
EOH'
}
# # encoding: utf-8
# this check works on all versions
check = "erl -eval \'erlang:display(erlang:system_info(otp_release)), halt().\' -noshell"
ver = command(check).stdout
if ver =~ /R\d*B\d*/
describe command(check) do
its('stdout') { should match /R\d*B\d*/ }
end
else
cmd = 'erl -eval \'{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().\''
describe command(cmd) do
its('stdout') { should match /\d?\.\d/ }
end
end
@test "run an erl command" {
sudo bash -c 'erl -myflag 1 <<-EOH
init:get_argument(myflag).
EOH'
}
# # encoding: utf-8
# this check works on all versions
check = "erl -eval \'erlang:display(erlang:system_info(otp_release)), halt().\' -noshell"
ver = command(check).stdout
if ver =~ /R\d*B\d*/
describe command(check) do
its('stdout') { should match /R\d*B\d*/ }
end
else
cmd = 'erl -eval \'{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().\''
describe command(cmd) do
its('stdout') { should match /\d?\.\d/ }
end
end
\ No newline at end of file
@test "run an erl command" {
sudo bash -c 'erl -myflag 1 <<-EOH
init:get_argument(myflag).
EOH'
}
# # encoding: utf-8
# this check works on all versions
check = "erl -eval \'erlang:display(erlang:system_info(otp_release)), halt().\' -noshell"
ver = command(check).stdout
if ver =~ /R\d*B\d*/
describe command(check) do
its('stdout') { should match /R\d*B\d*/ }
end
else
cmd = 'erl -eval \'{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().\''
describe command(cmd) do
its('stdout') { should match /\d?\.\d/ }
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment