Coder Social home page Coder Social logo

squeezer's Introduction

Build Status

Squeezer, an Ansible collection modules for Pulp

This collection provides a set of ansible modules to control a pulp server (version 3) in a descriptive way. This is neither to be confused with pulp_installer to install pulp, nor pulp_ansible to manage ansible content in pulp.

A lot of inspiration has been drawn from foreman-ansible-modules.

Installation

Install from Ansible Galaxy

The collection is available from Ansible Galaxy, so you can install it via

$ ansible-galaxy collection install pulp.squeezer

Build locally

Alternatively you can building the collection artifact with

$ make dist

and install the resulting tar.gz file with

$ ansible-galaxy collection install pulp-squeezer-<version>.tar.gz

Documentation

You can find the inline documentation of each module with ansible-doc pulp.squeezer.<module_name>.

Testing

Testing is done by running handcrafted playbooks from tests/playbooks while playing back prerecorded server answers. Using python virtual environments is recommended.

There is usually one playbook per module that it is meant to test, but that is not a hard requirement.

The playbooks are usually organized in three consecutive plays:

  • The first play is meant to setup the environment. Fixtures like dependent pulp resources can be prepared here. It runs against localhost to prevent recording any vcr tapes.
  • The second play contains the actual tests. This usually involves calling the module in question several times with varying parameters and verifying its output. Resources created in the first play can be referred to here. It is executed on the virtual host tests to allow for requests to the REST API and their corresponding responses to be recorded.
  • The third and last play is dedicated to cleanup. Any resources created (and maybe left over) in the previous two plays should be removed again here. Again with the target localhost, this part is not recorded.

During playback, only the prerecorded play in the middle is executed. Please make sure, that it can run independently from the others. Also it should not depend on any of the variables defined in tests/playbooks/vars/server.yaml other than the connection credentials.

To run the tests, you can either call make test, or make test_<playbook_name> to only run a specific one. To perform codestyle linting and ansible sanity checks, run make lint sanity.

To (re-)record tests or run live tests, you need a running pulp instance. Two common ways to provide that development server are explained below.

!!! Warning Do not use a production instance, as the tests might perform destructive actions.

Recording tests against a Pulplift Vagrant environment

A full vm installation of pulp can easily be achieved by using pulplift. It is recommended to use one of the sandbox installations. When the vm is up, you need to configure its connection details in tests/playbooks/vars/server.yaml. For example, to run all tests live against this vm:

+ make livetest +

The fixtures for the file_remote test can be recorded with:

+ make record_file_remote +

Running tests against a Pulp in one container

The tests/run_container.sh script is provided and allows you to run a command with a Pulp in one container active. It requires Docker or Podman to be installed. The default credentials in tests/playbooks/vars/server.yaml are sufficient. For example, to run all tests against the live Pulp instance:

./tests/run_container.sh make livetest

Or to record test fixtures for the rpm_repository test:

./tests/run_container.sh make record_rpm_repository

By default, the container will be stopped and removed when the script exits. Set KEEP_CONTAINER=1 to avoid removing the container to allow for debugging. Set IMAGE_TAG=<tag> to override the default latest tag for the pulp image.

Licence

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

squeezer's People

Contributors

mdellweg avatar markgoddard avatar evgeni avatar dependabot[bot] avatar alex-welsh avatar ziegenberg avatar netsandbox avatar fao89 avatar abdelli avatar cognifloyd avatar kpfleming avatar cityofships avatar quba42 avatar vkvm avatar spredzy avatar ajsween avatar karlism avatar keilr avatar

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.