bstinson / rats

Forked from rats 2 years ago
Clone

RATS

<colgroup></colgroup>
Author:Pierre-Yves Chibon <pingou@pingoured.fr>

RATS is the Run Another Test Service, an application aimed to be an API used by consumers (such as Bodhi or Pagure) to ask for a certain test to be re-run by the test system (that will need to listen to this rats' messages).

Homepage: https://pagure.io/rats

Use it

As a consumer, using rats is fairly simple, submit a POST or a GET request to the /submit endpoint with the following arguments

  • type:
    the type of element to test. They are the same types as defined in taskotron and pagure_pr.
  • item (optional if result_id is specified):
    the identifier of the element tested, so it could look like this:
    • koji_build : the NVR, for example: audit-2.8-1.fc26
    • bodhi_update : the bodhi update ID, for example: FEDORA-2017-5e475c0b0d
    • pagure_pr: the path to the pull-request, for example: rpms/python-arrow/pull-request/13
  • test (optional if result_id is specified):
    the test to re-run, for example: simple-koji-ci, AtomicCI, dist.rpmdeplint or update.base_selinux.
  • result_id (optional if item and test are specified):
    the unique identifier of a result in resultsdb. (The resultsdb url being defined in rats' configuration)
  • extras (optional)
    any extras information you want to be present in the fedmsg messages sent at the end of the process. This should be submitted as the text representation of a JSON blob.

Get it running

Manually

  • Install the needed system libraries:

    sudo dnf install git python2-virtualenv
    

    Note

    On Fedora 23 and earlier or on RHEL and derivative (CentOS, Scientific Linux) the package python2-virtualenv is named python-virtualenv

  • Retrieve the sources:

    git clone https://pagure.io/rats.git
    cd rats
    
  • Set up

    • Install dependencies

      • create the virtualenv:

        virtualenv rats_env
        source ./rats_env/bin/activate
        
      • Install the dependencies:

        pip install -r requirements.txt
        
    • Create rats/client_secrets.json:

      cd rats
      oidc-register https://iddev.fedorainfracloud.org http://localhost:5050
      
  • Run the webserver:

    ./runserver.py
    
    • To get some profiling information you can also run it as:

      ./runserver.py --profile
      

    This will launch the application at http://localhost:5050

  • Run the workers:

    celery worker -A rats.lib.tasks
    
  • Monitor fedmsg:

    • In a terminal, in the clone of the rats git repository, run:

      fedmsg-relay
      
    • In another terminal run:

      fedmsg-tail --really-pretty --no-validate
      

      The fedmsg messages sent by rats will be shown up in this second terminal.

  • To run unit-tests:

    • Install the dependencies:

      pip install -r test-requirements.txt
      
    • Run it:

      nosetests