Giter Club home page Giter Club logo

xtf's Introduction

XTF

XTF is framework designed to easy up aspects of testing in OpenShift environment.

Modules

Core

Core concepts of XTF framework used by other modules.

Configuration

While framework itself doesn't require any configuration it can easy up some repetative settings in tests. Setup of XTF can be done in 4 ways with priority from top to down:

  • System properties
  • Environment variables
  • test.properties file in root of the project designed to contain user specific setup. You can use -Dxtf.test_properties.path property to specify the location for the desired user specific setup.
  • global-test.properties file in root of the project designed to contain shared setup. You can use -Dxtf.global_test_properties.path property to specify the location for the desired user specific setup.

The mapping between system properties and environment variables is done by lower casing environment variable, replacing _ with . and adding xtf. before the result.

Example: OPENSHIFT_MASTER_URL is mapped to xtf.openshift.master.url.

OpenShift

OpenShift class is entry point for communicating with OpenShift. It extends OpenShiftNamespaceClient from Fabric8 client as is meant to be used within one namespace where tests are executed.

OpenShift class extends upstream version with several shortcuts. Eg. using deploymentconfig name only for retrieving any Pod or its log. This is usefull in test cases where we know that we have only one pod created by dc or we don't care which one will we get. The class itself also provides access to OpenShift specific Waiters.

Configuration:

Take a look at OpenShiftConfig class to see possible configurations. Enabling some them will allow you to instantiate as OpenShift openShift = OpenShifts.master().

Pull Secrets

There's a convenient method OpenShift::setupPullSecret() to setup pull secrets as recommended by OpenShift documentation. Property xtf.openshift.pullsecret is checked in ProjectCreator listener and BuildManager to populate projects with pull secret if provided. The pull secret is expected to be provided in Json format.

Single registry

{"auths":{"registry.redhat.io":{"auth":"<TOKEN>"}}}

Multiple registries

{"auths":{"registry.redhat.io":{"auth":"<TOKEN>"},"quay.io":{"auth":"<TOKEN>"}}}

Waiters

Waiter is a concept for conditional waiting. It retrieves an object or state in specified interval and checks for the specified success and failure conditions. When one of them is met, the waiter will quit. If neither is met in timeout, then exception is thrown.

XTF provides two different implementations (SimpleWaiter and SupplierWaiter) and several preconfigured instances. All the default parameters of preconfigured Waiters are overrideable.

OpenShifts.master().waiters().isDcReady("my-deployment").waitFor();

Https.doesUrlReturnsOK("http://example.com").timeOut(TimeUnit.MINUTES, 10).waitFor();

BuildManager

BuildManager cachces test builds in one namespace so they can be reused. After first time specified ManagedBuild succeds only the reference is returned but build is already present.

BuildManager bm = new BuildManagers.get();
ManagedBuild mb = new BinaryBuild("my-builder-image", Paths.resolve("/resources/apps/my-test-app"));
ManagedBuildReference = bm.deploy(mb);

bm.hasBuildCompleted().waitFor();

Image

Wrapper class for url specified images. It's puprose is to parse them or turn them into ImageStream objects.

Specifying images

Every image that is set in global-test.properties using xtf.{foo}.image can be accessed by using Images.get(foo).

Products

Allows to hold some basic and custom properties related to tested product image in properties file. Example considering maintenance of one image version:

xtf.foo.image=image.url/user/repo:tag
xtf.foo.version=1.0.3

XTF also considers possibility of maintenance of several versions. In this case add subId to your properties and specify xtf.foo.subid to activate particular properties (in your 'pom.xml' profile for example). Most of the properties can be shared for product. While image properties will override version properties.

Example considering maintenance of two image versions:

xtf.foo.image                               // Will override versions image property
xtf.foo.templates.repo=git.repo.url         // Will be used as default if not specified in version property
xtf.foo.v1.image=image.url/user/repoV1:tag1
xtf.foo.v1.version=1.0.3
xtf.foo.v2.image=image.url/user/repoV2:tag2
xtf.foo.v2.version=1.0.3

Retrieving an instance with this metadata: Produts.resolve("product");

JUnit5

JUnit5 module provides number of extensions and listeners designed to easy up OpenShift images test management. See JUnit5 for more informations.

xtf's People

Contributors

crumby avatar maschmid avatar dsimansk avatar mnovak1 avatar llowinge avatar istraka avatar tremes avatar pkremens avatar jbliznak avatar stanleykaleta avatar zroubalik avatar mocenas avatar lukasinko avatar radtriste avatar avano avatar sutaakar avatar liborfuka avatar simkam avatar mjurc avatar fmongiar avatar sgitario avatar ochaloup avatar spriadka avatar tomason avatar osmman avatar yegormaksymchuk avatar

Watchers

James Cloos avatar  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.