Skip to main content

Robot Framework service

Project description

RF-service

RobotFramework is a service for running tests/healthchecks for kubernetes cluster. It can work in two modes: on-demand execution with frontend and as Kubernetes CronJob that executes tests at given schedule and publish it in Caddy server.

Quick start

git clone https://github.com/devopsspiral/rf-service.git
cd rf-service
helm install rf-service ~/git/rf-service/chart/rf-service/

#By default rf-service-fe is exposed on http://rf-service.local
#If you running it on k3d/k3s you might need to add entries to you /etc/hosts

To run tests you need to first go to Configure tab and define fetcher (for getting test source) and publisher (to define where to put results). You can use internal caddy container as publisher target just use values from configuration file described in rf-service configuration.

If executed as CronJob with default settings, every minute there should be test execution and results will be published in Results tab. Executed tests are taken from KubeLibrary and will most probably fail on your cluster. If you want to see them pass you need k3s/k3d and example grafana service as described in KubeLibrary README.

Usage

Building own test image

rf-service image should contain only logic connected with running RobotFramework tests, to include external test libraries you should build your own image similar to dockerfile in docker-k8s/Dockerfile:

FROM mwcislo/rf-service

COPY docker-k8s/requirements.txt .

RUN pip install -r requirements.txt

CMD rf-service

By default helm chart is using this image for running tests

rf-service configuration

If rf-service is utilized as CronJob it needs .json file to configure its behaviour. It is passed as only argument to rf-service executable (see this line)

The example content of the file is as below:

  {
    "fetcher": {
        "type": "ZipFetcher",
        "url": "https://github.com/devopsspiral/KubeLibrary/archive/incluster.zip"
    },
    "publisher": {
        "type": "CaddyPublisher",
        "url": "http://rf-service:8090/uploads"
    }
  }

It configures rf-service to get testcases from given url (branch in github) and publish results in Caddy server using k8s service DN rf-service (providing you named release rf-service when executing helm install). You can create your own fetchers and publishers.

In helm chart, config file content can be defined using .Values.config and it is kept as ConfigMap on cluster.

When using Web UI (.Values.config is empty string) the same configuration can be done in Configure tab. You need to save both Publisher and Fetcher config separetly. To use internal Caddy container you need to pass http:///caddy/uploads, i.e. http://rf-service.local/caddy/uploads

Helm chart

Below you can find table with parameters that are most important.

Chart parameter Default Comment
image.repository mwcislo/rf-service-k8s should point to your custom test image
schedule */1 * * * * cron=like schedule for test execution
storageSize 1Gi volume size used for keeping reports in Caddy
config "" .json file with configuration
bindToClusterRole cluster-admin defines which cluster role to use
rfFE.service.type ClusterIP defines way of exposing rf-service-fe
caddy.setup ... configures caddy, upload part shouldn't be changed

Development

# clone repo
git clone https://github.com/devopsspiral/rf-service.git
cd rf-service

# create virtualenv
virtualenv .venv
. .venv/bin/activate
pip install --user -r requirements.txt
export PYTHONPATH=./src:${PYTHONPATH}
cd src
python -m rf_runner.api
# or
scripts/rf-service [config.json]
# API is on http://localhost:5000/api/


# testing
python -m unittest

References

Articles

Robot Framework library for testing Kubernetes Testing on kubernetes - rf-service Intro to Vue.js. Testing on kubernetes - rf-service frontend.

Repositories

KubeLibrary frontend

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rf-service-0.2.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

rf_service-0.2.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file rf-service-0.2.0.tar.gz.

File metadata

  • Download URL: rf-service-0.2.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for rf-service-0.2.0.tar.gz
Algorithm Hash digest
SHA256 50a261b3d0ba116b5a8dd9f23b98cb46597fec6758c482a23723e14f3cde248c
MD5 b9dfd044d6b2ae391f573a0194ed2cae
BLAKE2b-256 234bed909b26a0fdd9ced6129d33eb64968a7f8e48ce6a81ac713dfee97673f7

See more details on using hashes here.

File details

Details for the file rf_service-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rf_service-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for rf_service-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a52e1c759d5b680aae078fba1a8136fc27eeda0545bd70eda0147cabb3b9c55a
MD5 cd2b94b8c3d842e61deae24af5ca9f98
BLAKE2b-256 3b446b981563c98ba285d9612d9bcc99fc2dd58c16fc4715b6b2af3ae9d83dfe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page