Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow management of resources via attributes #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ suites:
run_list:
- recipe[test_tuned::create_provider_apply_profile]
attributes:
- name: manage
run_list:
- recipe[tuned::manage]
attributes:
tuned:
enabled_profile: latency-performance
- name: manage-custom
run_list:
- recipe[tuned::manage]
attributes:
tuned:
profile:
myprofile:
vm:
transparent_hugepage: never
transparent_hugepage.defrag: never
main:
include: latency-performance
enabled_profile: myprofile
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
default['tuned']['profile'] = {}

default['tuned']['enabled_profile'] = nil # used by recipes/manage.rb
54 changes: 54 additions & 0 deletions test/integration/manage-custom/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# path to common helper spec when running on test system
require 'spec_helper'

describe service('tuned') do
it { should be_enabled }
end

describe service('tuned') do
it { should be_running }
end

describe package('tuned') do
it { should be_installed }
end

describe file(libdir + 'myprofile') do
it { should be_directory }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should be_mode 644 }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should be_owned_by 'root' }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should be_grouped_into 'root' }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should contain('[vm]').after(/^/) }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should contain('transparent_hugepage=never').after(/^/) }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should contain('transparent_hugepage.defrag=never').after(/^/) }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should contain('[main]').after(/^/) }
end

describe file(libdir + 'myprofile/tuned.conf') do
it { should contain('include=latency-performance').after(/^/) }
end

describe command('tuned-adm active') do
its('stdout') { should match (/myprofile/) }
end
7 changes: 7 additions & 0 deletions test/integration/manage-custom/serverspec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'serverspec'

set :backend, :exec

def libdir
(os[:release].to_i < 7) ? '/etc/tune-profiles/' : '/usr/lib/tuned/'
end
18 changes: 18 additions & 0 deletions test/integration/manage/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# path to common helper spec when running on test system
require 'spec_helper'

describe service('tuned') do
it { should be_enabled }
end

describe service('tuned') do
it { should be_running }
end

describe package('tuned') do
it { should be_installed }
end

describe command('tuned-adm active') do
its('stdout') { should match (/latency-performance/) }
end
7 changes: 7 additions & 0 deletions test/integration/manage/serverspec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'serverspec'

set :backend, :exec

def libdir
(os[:release].to_i < 7) ? '/etc/tune-profiles/' : '/usr/lib/tuned/'
end