def check(): env.platform_family = detect.detect() if env.platform_family == "rhel": assert package.installed("httpd"), "httpd not installed" assert package.installed("holland"), "holland is not installed" assert package.installed("mysql55"), "mysql55 is not insalled" assert process.is_up("httpd"), "process httpd not running" assert service.is_enabled("httpd"), "httpd not enabled" # welcome.conf causes a 403 when running apache_is_responding() # with the stock build. if env.platform_family == "debian": print "Ubuntu 12.04/14.04 or Debian 7.x/8.x" assert package.installed("apache2"), "apache2 is not installed" assert package.installed("mysql-server-5.5"), ("mysql-server-5.5 not" + " installed") assert process.is_up("apache2"), "apache2 is not running" assert service.is_enabled("apache2"), "apache2 is not enabled" assert apache_is_responding(), "apache2 is not responding" assert port.is_listening(80), "port 80 not listening" assert port.is_listening(443), "port 443 not listening" assert port.is_listening(3306), "port 3306 not listening" assert phpmyadmin_is_responding(), "phpmyadmin is not responding" assert holland_is_running(), "holland cannot run"
def check(): env.platform_family = detect.detect() assert file.is_dir("/var/www/vhosts") assert port.is_listening(80) assert package.installed("holland") assert drupal_is_responding(), 'Drupal did not respond as expected.' apache_process = 'apache2' php_package = 'php5' mysql_process = 'mysql' if env.platform_family == 'debian': apache_process = 'apache2' php_package = 'php5' mysql_process = 'mysql' elif env.platform_family == 'rhel': apache_process = 'httpd' php_package = 'php' mysql_process = 'mysqld' else: raise ValueError('OS ' + env.platform_family + ' unknown, update tests.') assert package.installed(php_package) assert process.is_up(apache_process) assert process.is_up(mysql_process) assert service.is_enabled(apache_process) assert service.is_enabled(mysql_process)
def holland(): # Verify hollandbackup package is installed with a default backupset env.platform_family = detect.detect() assert package.installed("holland") assert package.installed("holland-mysqldump") assert file.exists("/etc/holland/backupsets/default.conf")
def check(): env.platform_family = detect.detect() assert file.is_dir("/var/www/vhosts"), '/var/www/vhosts is wrong' assert port.is_listening(80), 'port 80 not listening' assert port.is_listening(8080), 'port 8080 not listening' assert package.installed("varnish"), 'varnish not installed' assert drupal_is_responding(), 'Drupal did not respond as expected.' apache_process = 'apache2' php_package = 'php5' if env.platform_family == 'debian': apache_process = 'apache2' php_package = 'php5' elif env.platform_family == 'rhel': apache_process = 'httpd' php_package = 'php' else: raise ValueError('OS ' + env.platform_family + ' unknown, update tests.') assert package.installed(php_package), 'php not installed' assert process.is_up(apache_process), 'apache is not running' assert service.is_enabled(apache_process), 'apache is not enabled'
def check(): env.platform_family = detect.detect() assert package.installed("jenkins") assert package.installed("jenkins-cli") assert file.exists("/etc/jenkins/cli.conf") assert port.is_listening(8080) assert port.is_listening(8081) assert user.exists("jenkins") assert process.is_up("daemon") assert service.is_enabled("jenkins") assert jenkins_is_responding_on_http()
def acceptance_tests_on_ubuntu14_img_for_flocker(distribution): """ checks that the Ubuntu 14 image is suitable for running the Flocker acceptance tests :param string distribution: which OS to use 'centos7', 'ubuntu1404' """ with settings(): env.platform_family = detect.detect() # Jenkins should call the correct interpreter based on the shebang # However, # We noticed that our Ubuntu /bin/bash call were being executed # as /bin/sh. # So we as part of the slave image build process symlinked # /bin/sh -> /bin/bash. # https://clusterhq.atlassian.net/browse/FLOC-2986 log_green('check that /bin/sh is symlinked to bash') assert file.is_link("/bin/sh") assert 'bash' in run('ls -l /bin/sh') # the client acceptance tests run on docker instances log_green('check that docker is enabled') assert 'docker' in run('ls -l /etc/init') # make sure we installed all the packages we need log_green('assert that required deb packages are installed') for pkg in ubuntu14_required_packages(): log_green('... checking package: %s' % pkg) assert package.installed(pkg) # Our tests require us to run docker as ubuntu. # So we add the user ubuntu to the docker group. # During bootstrapping of the node, jenkins will update the init # file so that docker is running with the correct group. # TODO: move that jenkins code here log_green('check that ubuntu is part of group docker') assert user.exists("ubuntu") assert group.is_exists("docker") assert user.is_belonging_group("ubuntu", "docker") # the acceptance tests look for a package in a yum repository, # we provide one by starting a webserver and pointing the tests # to look over there. # for that we need 'nginx' installed and running log_green('check that nginx is running') assert package.installed('nginx') assert port.is_listening(80, "tcp") assert process.is_up("nginx") assert 'nginx' in run('ls -l /etc/init.d/')
def check(): env.platform_family = detect.detect() assert package.installed("java-common") assert package.installed("nginx") assert file.exists("/usr/local/bin/elasticsearch") assert port.is_listening(9200) assert port.is_listening(9300) assert port.is_listening(8080) assert user.exists("elasticsearch") assert group.is_exists("elasticsearch") assert user.is_belonging_group("elasticsearch", "elasticsearch") assert process.is_up("java") assert process.is_up("nginx") assert service.is_enabled("nginx") assert service.is_enabled("elasticsearch")
def check(): env.platform_family = detect.detect() assert package.installed("mysql-server-5.5") assert port.is_listening(3306) assert process.is_up("mysqld") assert file.exists("/root/.my.cnf")
def check(): env.platform_family = detect.detect() packages = ['st2common', 'st2reactor', 'st2actions', 'st2api', 'st2auth', 'st2debug', 'python-st2client', 'rabbitmq-server', 'mongodb-server', 'mysql-server' ] services = ['actionrunner', 'st2api', 'sensor_container', 'rules_engine', 'mistral', 'st2resultstracker', 'rabbitmq-server', 'mongodb', 'mysql' ] for pkg in packages: assert package.installed(pkg),\ "package {0} is not installed".format(pkg) for srv in services: assert service.is_enabled(srv),\ "service {0} is not enabled".format(srv) assert user.exists("stanley"), "user stanley does not exist"
def check(): env.platform_family = detect.detect() # file assert file.exists("/etc/hosts") assert file.is_file("/etc/hosts") assert file.is_dir("/tmp/") assert file.dir_exists("/tmp/") assert file.has_line("/etc/passwd", "sshd") assert file.owner_is("/bin/sh", "root") if env.platform_family == "freebsd": assert file.is_link("/compat") assert file.group_is("/bin/sh", "wheel") assert file.mode_is("/bin/sh", "555") else: assert file.is_link("/usr/tmp") assert file.group_is("/bin/sh", "root") assert file.mode_is("/bin/sh", "777") assert package.installed("wget.x86_64") assert user.exists("sshd") assert user.is_belonging_group("worker", "users") assert group.is_exists("wheel") assert port.is_listening(22) assert cron.has_entry('shirou', 'python') if env.platform_family == "freebsd": assert service.is_enabled("apache22") assert process.is_up("httpd") else: assert service.is_enabled("http") assert process.is_up("http") is False
def check(): env.platform_family = detect.detect() for pkg in ["rabbitmq-server", "python-pip", "curl", "unzip", "supervisor", "dnsmasq"]: assert package.installed(pkg), \ "package {} is not installed".format(pkg) for path in ["/var/lib/rabbitmq/.erlang.cookie", "/etc/supervisor/conf.d/consul.conf", "/usr/local/lib/supervisor/start_consul.sh", "/etc/dnsmasq.d/consul_dns.conf"]: assert file.exists(path), "file {} does not exist".format(path) assert port.is_listening(5672), "port 5672 (RabbitMQ) is not listening" assert user.exists("rabbitmq"), "there is no rabbitmq user" assert group.is_exists("rabbitmq"), "there is no rabbitmq group" assert process.is_up("supervisord"), "supervisord is not running" assert process.is_up("consul"), "consul is not running" assert process.is_up("epmd"), "epmd is not running" assert process.is_up("beam.smp"), "beam.smp is not running" assert process.is_up("dnsmasq"), "dnsmasq is not running" assert service.is_enabled("rabbitmq-server"), "nginx is not enabled" assert service.is_enabled("supervisor"), "supervisor is not enabled" assert amqp_works(env.amqp_login, env.amqp_password, env.host), \ "RabbitMQ did not respond as expected"
def check(): env.platform_family = detect.detect() packages = ['st2', 'st2chatops', 'st2mistral', 'st2web', 'rabbitmq-server', 'mongodb-org-server', 'postgresql' ] services = ['st2api', 'st2sensorcontainer', 'mistral', 'st2resultstracker', 'rabbitmq-server', 'mongod', 'postgresql' ] for pkg in packages: assert package.installed(pkg),\ "package {0} is not installed".format(pkg) for srv in services: assert service.is_enabled(srv),\ "service {0} is not enabled".format(srv) assert user.exists("stanley"), "user stanley does not exist"
def mysql(): env.platform_family = detect.detect() if env.platform_family == 'debian': mysql_package = 'mysql-server-5.5' mysql_process = 'mysql' holland_package = 'holland' elif env.platform_family == 'rhel': mysql_package = 'mysql-server' mysql_process = 'mysqld' holland_package = 'holland' else: raise ValueError('OS ' + env.platform_family + ' unknown, update tests.') packages = [holland_package, mysql_package] for pkg in packages: assert package.installed(pkg), ('package ' + pkg + 'not found') assert port.is_listening(3306), '3306 not listening' root_my_cnf = "/root/.my.cnf" assert file.exists(root_my_cnf), 'root my.cnf does not exist' assert file.mode_is(root_my_cnf, 600), \ 'permissions are wrong on root my.cnf' assert file.owner_is(root_my_cnf, "root"), 'owner is wrong on root my.cnf' assert process.is_up(mysql_process), 'mysql is not running' assert service.is_enabled(mysql_process), 'mysql is not enabled'
def memcached(): env.platform_family = detect.detect() assert package.installed("memcached") assert port.is_listening(11211) assert process.is_up("memcached") assert service.is_enabled("memcached")
def check(): env.platform_family = detect.detect() assert package.installed("jenkins") assert port.is_listening(8080) assert user.exists("jenkins") assert service.is_enabled("jenkins") assert jenkins_is_responding_on_http()
def check(): env.platform_family = detect.detect() assert package.installed("lxc-docker") assert file.exists("/etc/default/docker") assert file.exists("/var/run/docker.sock") assert process.is_up("docker") assert service.is_enabled("docker")
def check(): env.platform_family = detect.detect() assert package.installed("jenkins"), 'Jenkins is not installed' assert port.is_listening(8080), 'Jenkins is not listening' assert user.exists("jenkins"), 'Jenkins user does not exist' assert service.is_enabled("jenkins"), 'Jenkins service is not enabled' assert jenkins_is_responding_on_http(), 'Jenkins is not responding'
def check(): env.platform_family = detect.detect() assert package.installed("apache2") assert package.installed("memcached") assert file.is_dir("/opt/graphite") assert file.exists("/etc/sv/statsd") assert port.is_listening(443) assert port.is_listening(2003) assert port.is_listening(2004) assert port.is_listening(8126) assert user.exists("statsd") assert process.is_up("apache2") assert process.is_up("memcached") assert service.is_enabled("apache2") assert service.is_enabled("memcached") assert graphite_is_responding()
def disabled_test_hello_systemvm_envassert(self): """Test we can run envassert assertions on the systemvm""" assert file.exists('/etc/hosts') for packageName in ['dnsmasq', 'haproxy', 'keepalived', 'curl']: assert package.installed(packageName), 'package %s should be installed' % packageName assert user.exists('cloud'), 'user cloud should exist'
def check(): env.platform_family = detect.detect() assert package.installed("memcached") assert file.exists("/etc/memcached.conf") assert port.is_listening(11212) assert process.is_up("memcached") assert service.is_enabled("memcached")
def monitoring(): env.platform_family = detect.detect() monitor_config = "/etc/rackspace-monitoring-agent.cfg" assert package.installed("rackspace-monitoring-agent") assert process.is_up("rackspace-monitoring-agent") assert service.is_enabled("rackspace-monitoring-agent") assert file.exists(monitoring_config)
def disabled_test_hello_systemvm_envassert(self): """Test we can run envassert assertions on the systemvm""" assert file.exists('/etc/hosts') for packageName in ['dnsmasq', 'haproxy', 'keepalived', 'curl']: assert package.installed( packageName), 'package %s should be installed' % packageName assert user.exists('cloud'), 'user cloud should exist'
def apache2(): assert package.installed("apache2") assert service.is_enabled("apache2") assert service.is_up("apache2") assert port.is_listening(80) assert file.is_file("/etc/apache2/httpd.conf") assert file.has_line("/etc/apache2/httpd.conf", "ServerName localhost")
def apache(): env.platform_family = detect.detect() apache_config = "/etc/apache2/sites-enabled/wordpress.conf" assert package.installed("apache2") assert process.is_up("apache2") assert service.is_enabled("apache2") assert port.is_listening(8080) assert file.has_line(apache_config, "VirtualHost *:8080")
def varnish(): env.platform_family = detect.detect() varnish_config = "/etc/varnish/default.vcl" assert package.installed("varnish") assert process.is_up("varnishd") assert service.is_enabled("varnish") assert port.is_listening(80) assert file.has_line(varnish_config, "backend master") assert file.has_line(varnish_config, "backend local")
def check(): env.platform_family = detect.detect() assert package.installed("jenkins") assert file.exists("/var/lib/jenkins/hudson.model.UpdateCenter.xml") assert port.is_listening(8080) assert port.is_listening(8081) assert user.exists("jenkins") assert process.is_up("daemon") assert service.is_enabled("jenkins") assert jenkins_is_responding_on_http()
def check(): env.platform_family = detect.detect() assert package.installed("nginx"), 'nginx not installed' assert package.installed("mysql-server-5.5"), \ 'mysql-server-5.5 not installed' assert file.exists("/usr/local/bin/node"), 'node not found' assert file.exists("/usr/local/bin/npm"), 'npm not found' assert port.is_listening(80), '80/nginx is not listening' assert port.is_listening(2368), '2368/node is not listening' assert port.is_listening(3306), '3306/mysqld is not listening' assert user.exists("ghost"), 'ghost user does not exist' assert group.is_exists("ghost"), 'ghost group does not exist' assert user.is_belonging_group("ghost", "www-data"), \ 'ghost user not in group www-data' assert process.is_up("nginx"), 'nginx is not running' assert process.is_up("node"), 'node is not running' assert process.is_up("mysqld"), 'mysqld is not running' assert service.is_enabled("nginx"), 'nginx service not enabled' assert service.is_enabled("mysqld"), 'mysqld service not enabled' assert ghost_is_responding(), 'Ghost did not respond as expected'
def check(): env.platform_family = detect.detect() assert package.installed("td-agent") assert file.exists("/etc/td-agent/td-agent.conf") assert port.is_listening(8888) assert port.is_listening(24224) assert user.exists("td-agent") assert group.is_exists("td-agent") assert user.is_belonging_group("td-agent", "td-agent") assert process.is_up("ruby") assert service.is_enabled("td-agent")
def check(): env.platform_family = detect.detect() assert package.installed("drone"), "Package drone is missing." assert file.exists("/etc/drone/drone.toml"), \ "/etc/drone/drone.toml is missing." assert file.exists("/etc/pki/drone/certs/drone.crt"), \ "SSL certificate missing." assert file.exists("/etc/pki/drone/certs/drone.key"), "SSL key missing." assert port.is_listening(443), "Port 443 is not listening." assert process.is_up("droned"), "The droned process is not running." assert service.is_enabled("drone"), "The drone service is not enabled." assert drone_is_responding(), "Drone is not responding."
def apache(): env.platform_family = detect.detect() apache_config = "/etc/apache2/sites-enabled/wordpress.conf" web_user = "******" www_dir = "/var/www/vhosts/example.com" assert package.installed("apache2") assert process.is_up("apache2") assert service.is_enabled("apache2") assert port.is_listening(8080) assert file.has_line(apache_config, "VirtualHost *:8080") assert file.owner_is(www_dir, web_user)
def check(): env.platform_family = detect.detect() assert package.installed("apache2") assert file.exists("/srv/venv/bin/django-admin.py") assert file.exists("/etc/apache2/mods-enabled/wsgi.conf") assert file.exists("/etc/apache2/mods-enabled/wsgi.load") assert port.is_listening(80) assert user.exists("pydev") assert group.is_exists("pydev") assert user.is_belonging_group("pydev", "pydev") assert process.is_up("apache2") assert service.is_enabled("apache2")
def check(): env.platform_family = detect.detect() assert package.installed("chef-server-core") assert file.exists("/etc/opscode/chef-server.rb") assert port.is_listening(80) assert port.is_listening(443) assert user.exists("opscode") assert group.is_exists("opscode") assert user.is_belonging_group("opscode", "opscode") assert process.is_up("nginx") assert process.is_up("postgres") assert service.is_enabled("nginx") assert service.is_enabled("postgres")
def mysql(): env.platform_family = detect.detect() packages = ["holland", "mysql-server"] for pkg in packages: assert package.installed(pkg) assert port.is_listening(3306) assert process.is_up("mysqld") root_my_cnf = "/root/.my.cnf" assert file.exists(root_my_cnf) assert file.mode_is(root_my_cnf, 600) assert file.owner_is(root_my_cnf, "root")
def check(): env.platform_family = detect.detect() site = "http://localhost/" string = "example.com" apache_process = 'apache2' php_package = 'php5' mysql_process = 'mysql' assert port.is_listening(80), 'Port 80 is not listening.' assert package.installed(php_package), 'PHP is not installed.' assert process.is_up(apache_process), 'Apache is not running.' assert process.is_up(mysql_process), 'MySQL is not running.' assert service.is_enabled(apache_process), 'Apache is disabled at boot.' assert service.is_enabled(mysql_process), 'MySQL is disabled at boot.' assert http_check(site, string), 'Drupal is not responding as expected.'
def lsyncd(): env.platform_family = detect.detect() wordpress_user = "******" web_group = "www-data" ssh_dir = "/var/www/vhosts/example.com/.ssh" private_key = os.path.join(ssh_dir, "id_rsa") assert package.installed("lsyncd"), 'lsyncd is not installed' assert process.is_up("lsyncd"), 'lsyncd is not up' assert service.is_enabled("lsyncd"), 'lsyncd is not enabled' assert user.exists(wordpress_user), 'wp_user user does not exist' assert user.exists('wp_user').get('passwd') != '!', 'wp_user pass missing' assert user.is_belonging_group( wordpress_user, web_group), 'wp_user does belong to correct group' assert file.dir_exists(ssh_dir), 'ssh directory does not exist' assert file.owner_is(ssh_dir, wordpress_user), 'wp_user does not own ssh directory' assert file.owner_is(private_key, wordpress_user), 'wp_user does not own ssh key' assert file.mode_is(private_key, 600), 'ssh key is not set to correct mode'