# frozen_string_literal: true

# Inspec test for recipe irrigate-wowza::default

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

# Check if streaming engine service is running
describe systemd_service('WowzaStreamingEngine') do
  it { should be_installed }
  it { should be_enabled }
  it { should be_running }
end

# Check if streaming engine manager service is running
describe systemd_service('WowzaStreamingEngineManager') do
  it { should be_installed }
  it { should be_enabled }
  it { should be_running }
end

# This is an port test, checks if instance is listening  on management port 8088.
describe port(8088) do
  it { should be_listening }
  its('processes') { should include 'WowzaStreamingEngineManager' }
end

# This is an port test, checks if instance is listening  on streaming engine port 1935.
describe port(1935) do
  it { should be_listening }
  its('protocols') { should include 'tcp' }
end

# Check if Application.xml exist for vods3 application
describe file('/usr/local/WowzaStreamingEngine/conf/vods3/Application.xml') do
  it { should exist }
end

# Check if MediaCache.xml exist for s3
describe file('/usr/local/WowzaStreamingEngine/conf/MediaCache.xml') do
  it { should exist }
end
