Cucumber steps definitions for the OpenShift API.
It allows you to write things like
Given My current project is "hello-openshift" When I create a new application based on the template "hello-openshift" with parameters "APPLICATION_NAME=hello" Then I should have a deploymentconfig "hello" And I should have a service "hello" ... Given I have a buildconfig "hello" When I start a new build of "hello" Then the latest build of "hello" should succeed in less than "5m" ... Given I have a deploymentconfig "hello" When the deploymentconfig "hello" has at least 1 deployment Then the latest deployment of "hello" should succeed in less than "3m" ... When I have a successful deployment of "hello" Then I can access the application through the route "hello"
You can find more complete examples in the examples directory.
With it, you can write complete tests for your application deployment on OpenShift:
- login (or token validation)
- project creation
- credentials setup (secrets and serviceaccounts)
- templates creation
- applications creation
- build status
- deployment status
- route http check
It does not include all features available in OpenShift, but it's easy to add more step definitions ;-)
Write Cucumber feature files, and then just run
openshift-cucumber with the path of yours files as argument.
openshift-cucumber relies on environment variables to login:
OPENSHIFT_HOST: the OpenShift server (for example:
OPENSHIFT_USER: the username (if you want to perform a login - in this case you also need to provide a password)
OPENSHIFT_PASSWD: the password
OPENSHIFT_TOKEN: the token (if you just want to validate a ServiceAccount token - in this case, you don't need the user or password)
If you want to run the provided examples againt a local instance of OpenShift:
$ export OPENSHIFT_HOST="https://localhost:8443" $ export OPENSHIFT_USER="demo" $ export OPENSHIFT_PASSWD="demo" $ openshift-cucumber examples
Output / Reporting
openshift-cucumber print each step and its result (either success in green, or failure in red) in the standard output.
You can also configure a reporter:
You need to configure the
openshift-cucumber --reporter="junit" --output="/path/to/results.xml" /path/to/feature-files
Pre-build binaries for the main platforms (
windows-amd64) are available in bintray:
Building from sources
openshift-cucumber is written in Go. To build it, you need:
Then, you can run
godep go install to build the
openshift-cucumber executable (in
To make things easier, you can use the provided
Dockerfile to build in a Docker environment:
Build a docker image:
docker build -t openshiftcucumber -f Dockerfile.build .
And build the project in a container (the default command is
gox, which will build binaries for the main platforms)
docker run --rm -v $PWD:/go/src/github.com/vbehar/openshift-cucumber openshiftcucumber
The binaries will be available in the
Copyright 2015 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.