Package: rf-service
RF-serviceRF-service is a service for running tests. In long run it should provide functionality that covers everything between writing tests and viewing test results, by simplifing when, how and where to run the tests. It can work in two modes: on-demand execution withfrontendand as Kubernetes CronJob that executes tests at given schedule. Rf-service is also packaged as a container image so it can be used in other ways, like for example with Octopus (seearticle on that).Quick startgit 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/hostsTo 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 inrf-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 fromKubeLibraryand will most
probably fail on your cluster. If you want to see them pass you need k3s/k3d and example grafana service as described inKubeLibrary README.Usage0.3.1 changesHelm chart doesn't support those changes yet.SeeTesting with octopus.CLI improvementsSince 0.3.1 rf-service can be configured using CLI parameters in a form of:rf-service --LocalFetcher-src ~/test/source --LocalPublisher-dest ~/test/resultswhich is equivalent of:{
    "fetcher": {
        "type": "LocalFetcher",
        "src": "~/test/source"
    },
    "publisher": {
        "type": "LocalPublisher",
        "dest": "~/test/results"
    }
}Additionally CLI support following flags:CLI parameterComment-i/--includeinclude test tags-e/--excludeexclude test tagsDependency resolutionIn a path towards making rf-service generic enough to be executed as a base for different kinds of testcases, support for pip requirements was added. This way if fetcher collects directory containgrequirements.txtfile, it will install packages as withpip install -r requirements.txt. Just remember first spotted requirements.txt file will be used, so it is best to keep one in top level directory.Building own test imagerf-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 indocker-k8s/Dockerfile:FROM mwcislo/rf-service

COPY docker-k8s/requirements.txt .

RUN pip install -r requirements.txt

CMD rf-serviceBy default helm chart is using this image for running testsrf-service configurationIf rf-service is utilized as CronJob it needs .json file to configure its behaviour. It is passed as only argument to rf-service executable (seethis 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 passhttp://localhost:8090/uploads- as all the containers are part of the same pod, all the ports are accessible on localhost.Helm chartBelow you can find table with parameters that are most important.Chart parameterDefaultCommentimage.repositorymwcislo/rf-service-k8sshould point to your custom test imageschedule*/1 * * * *cron=like schedule for test executionstorageSize1Givolume size used for keeping reports in Caddyconfig"".json file with configurationbindToClusterRolecluster-admindefines which cluster role to userfFE.service.typeClusterIPdefines way of exposing rf-service-fecaddy.setup...configures caddy, upload part shouldn't be changedDevelopment# 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]
# or from docker
docker run -it --rm -p 5000:5000 mwcislo/rf-service:0.x.0
# API is on http://localhost:5000/api/


# testing
python -m unittestReferencesArticlesRobot Framework library for testing KubernetesTesting on kubernetes - rf-serviceIntro to Vue.js. Testing on kubernetes - rf-service frontend.Testing with octopusRepositoriesKubeLibraryrf-service-fe