Coder Social home page Coder Social logo

ypu / atomic-host-tests Goto Github PK

View Code? Open in Web Editor NEW

This project forked from projectatomic/atomic-host-tests

0.0 0.0 0.0 474 KB

A collection of single-host tests for Atomic Host

License: GNU General Public License v3.0

Shell 49.21% Python 50.79%

atomic-host-tests's Introduction

Stream Version/Status Log File
Centos Atomic Host Continuous cahc status log
Fedora Atomic Host Continuous fahc status log
Fedora 25 Atomic Host fedora 25 atomic status log
Fedora 25 Atomic Testing fedora 25 atomic testing status log
Fedora 25 Atomic Updates fedora 25 atomic updates status log
Fedora 26 Atomic Host fedora 26 atomic status log
Fedora 26 Atomic Testing fedora 26 atomic testing status log
Fedora 26 Atomic Updates fedora 26 atomic updates status log
Fedora Rawhide Atomic Host fedora rawhide atomic status log

Atomic Host Tests

This repo contains a number of Ansible playbooks that can be used to run tests against an Atomic Host.

The intent is to have a collection of tests that can be used to test the CentOS, Fedora, and RHEL versions of Atomic Host.

Currently, these tests fall into the category of single host, integration tests.

NOTE: This repo only provides playbooks/tests and does not currently provide any way for provisioning test resources/infrastructure.

Supported Test Suites

The following test suites are available and supported. Any other playbooks found in the repo are currently unmaintained and may not work correctly.

  • ostree admin unlock
    • Verifies the ability to install packages using ostree admin unlock
  • Docker Build httpd
    • Attempts to build a httpd container using various base images
  • Docker Swarm
    • Covers the basic functionality of the docker swarm commands
  • Docker/Docker Latest
    • Validates basic docker operations using either docker or docker-latest
  • Improved Sanity Test
    • A test suite aimed at providing smoketest-like coverage of an entire Atomic Host
  • Kubernetes
    • Validates standing up a single-node Kubernetes cluster and deploying a simple web+DB application
  • Package Layering
    • Validates the package layering functionality of rpm-ostree
  • System Containers
    • Verifies the basic usage of system containers on Atomic Host
  • Runc
    • Verifies basic runc functions

Why Ansible?

The reasons for choosing Ansible playbooks are mainly 1) ease of use, 2) portability, and 3) simplicity.

  1. Ansible is a well-known tool and there is plenty of documentation available for users to rely on.

  2. Ansible requires only a small amount of functionality on the system under test (basically Python and SSH), so playbooks can be used across multiple platforms with little changes necessary.

  3. Fail fast and early. When a task in Ansible fails, the whole playbook fails (for the most part). Thus, if something fails during the execution, that is a good indication that something broke.

Virtual Environment

The preferred environment to run the playbooks is using a virtual environment. This will ensure the correct version of Ansible is installed and will not interfere with your current workspace.

To setup a virtualenv, follow the steps below after cloning atomic-host-tests:

pip install virtualenv
virtualenv my_env
source my_env/bin/activate
pip install -r requirements.txt

Running Playbooks

All the playbooks should be able to be run without any extra options on the command line. Like so:

# ansible-playbook -i inventory tests/improved-sanity-tests/main.yml

However, some tests do accept extra arguments that can change how the test is run; please see the README for each test for details.

Additionally, certain variables are required to be configured for each test and the required variables can vary between tests. There are sensible defaults provided, but it is up to the user to configure them as they see fit.

NOTE: Playbooks are developed and tested using Ansible 2.2. Older versions will not work.

Log Options

By default Ansible logs to stdout. Atomic host tests has a custom callback plugin that makes the output more human readable. In addition there are a few custom log options described below.

Capture failure details

If the environment variable AHT_RESULT_FILE is set, Ansible will save the details of the failed task into file named after the value of the environment variable in the current working directory.

export AHT_RESULT_FILE=my_failure_file

In this example the failure details will be saved to ./my_failure_file

Capture journal on failure

Ansible handlers are used to capture the journal on failure. This feature can be enabled using a role or an include which must be called in every block of pre_tasks, post_tasks, tasks, roles, or plays. Force_handlers must be set to true regardless of which method is used.

force_handlers: true
To use journal capture as role:
- role: handler_notify_on_failure
  handler_name: h_get_journal
To use journal capture as include:
- include: 'atomic-host-tests/roles/handler_notify_on_failure/task/main.yml'
  handler_name: h_get_journal

In addition, the handler must be included since using include doesn't automatically pull in the handler. This is typically done at the end of the block.

handlers:
  - include: 'atomic-host-tests/roles/handler_notify_on_failure/handlers/main.yml'

NOTE The path should be relative to the path of the playbook

Vagrant

You can see how the playbooks would run by using the supplied Vagrantfile which defines multiple boxes to test with. The Vagrantfile requires a 'vagrant-reload' plugin available from the following GitHub repo:

https://github.com/aidanns/vagrant-reload

With the plugin installed, you should be able to choose a CentOS AH box, a Fedora 24/25 AH box, or a CentOS AH Continuous (CAHC) box.

$ vagrant up centos

or

$ vagrant up {fedora24|fedora25}

or

$ vagrant up cahc

By default, the Vagrantfile will run the tests/improved-sanity-tests/main.yml playbook after Vagrant completes the provisioning of the box. The playbook which is run can be changed by setting the environment variable PLAYBOOK_FILE to point to a playbook in the repo.

$ PLAYBOOK_FILE=tests/docker-swarm/main.yml vagrant up cahc

NOTE: By default, the Vagrant boxes will provision HEAD-1 of the flavor of Atomic Host you want to bring up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.