require 'serverspec' set :backend, :exec puts puts '================================' puts %x(ansible --version) puts '================================' describe package('influxdb') do it { should be_installed } end describe file('/etc/influxdb/influxdb.conf') do it { should be_file } it { should be_mode 644 } it { should be_owned_by 'root' } it { should be_grouped_into 'root' } it { should contain 'enabled = true' } end describe service('influxdb') do it { should be_enabled } it { should be_running.under('systemd') } end describe port(8086) do it { should be_listening.with('tcp6') } end describe port(25_826) do it { should be_listening.with('udp6') } end describe command('influx -execute "SHOW USERS"') do its(:exit_status) { should eq 0 } its(:stdout) { should match(/paul\s+true/) } its(:stdout) { should match(/adrien\s+false/) } its(:stdout) { should_not match 'antoine' } end describe command('influx -execute "SHOW DATABASES"') do its(:exit_status) { should eq 0 } its(:stdout) { should match 'new_database' } end describe command('influx -execute "SHOW GRANTS FOR adrien"') do its(:exit_status) { should eq 0 } its(:stdout) { should match(/new_database\s+WRITE/) } end