# # encoding: utf-8

# Inspec test for recipe irrigate-sftp::default

# The Inspec reference, with examples and extensive documentation, can be
# found at http://inspec.io/docs/reference/resources/

# Test if ssh service is running
describe systemd_service('sshd') do
  it { should be_installed }
  it { should be_enabled }
  it { should be_running }
end

# This is a port test, checks if instance is listening on port 22
describe port(22) do
  it { should be_listening }
  its('protocols') { should include 'tcp' }
end

# Test if sftp user group exists
describe group('sftp') do
  it { should exist }
end

# Test if sshd_config file exists
describe file('/etc/ssh/sshd_config') do
  it { should exist }
end

# Test if s3fs credentials exists
describe file('/etc/passwd-s3fs') do
  it { should exist }
end

# Test if mounted directory exists
describe file('/mnt/sftp') do
  it { should be_directory }
  it { should be_owned_by 'root' }
  it { should be_grouped_into 'sftp' }
end
