Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
Jeremy Poulin edited this page May 31, 2018 · 9 revisions

Getting Started

Once the libraries have been installed, you can access the TestUtils object to call into the automated scripts. There are three basic functions: getProvisioningConfig, runTest, and runParallelMultiArchTest.

Installing the Libraries

In your Jenkinsfile, you'll want to add the following block

library(
  changelog: false,
  identifier: "multiarch-ci-libraries@${params.LIBRARIES_REF}",
  retriever: modernSCM([$class: 'GitSCMSource',remote: "${params.LIBRARIES_REPO}"])
)

This assumes you'll be supplying the repository name and URL via the job parameters.

Getting the Provisioning Config

Now that you've installed the libraries, the first thing you'll want to do is fetch the ProvioningConfig object. This object and its options are described in the Provisioning Configuration page.

TestUtils Functions

These static functions are available through the TestUtils class.

TestUtils.runTest

If you're looking to run a test on a single architecture, you can use the TestUtils.runTest function.

As of release v1.0, this function has 6 parameters. The postTest parameter is optional in order to maintain compatibility with previous releases.

script

  • Description: Usually this is just the "this" object of your test. It gives the library access to pipeline steps such as sh.
  • Type: WorkflowScript

arch

  • Description: Specifies the arch to run the test on.
  • Type: String
  • Valid Values: x86_64, ppc64le, aarch64, s390x

config

test

  • Description: Closure that takes a single parameter of type com.redhat.multiarch.ci.provisioner.Host and wraps your test.
  • Type: Closure

onTestFailure

  • Description: Closure that takes a two parameters. The first is of type com.redhat.multiarch.ci.provisioner.Host, and the second is of type Exception. This is called in the situation that your test closure fails.
  • Type: Closure

postTest

  • Description: Closure that is run after the test. It takes no parameters, and does nothing by default.
  • Optional: true
  • Type: Closure

TestUtils.runParallelMultiArchTest

If you're looking to run a test on a multiple architectures in parallel, you can use the TestUtils.runParallelMultiArchTest function.

This function has 6 parameters.

script

  • Description: Usually this is just the "this" object of your test. It gives the library access to pipeline steps such as sh.
  • Type: WorkflowScript

arches

  • Description: Specifies a comma separated list of arches to run the test on.
  • Type: List<String>
  • Valid Values: A non-empty subset of ['x86_64', 'ppc64le', 'aarch64', 's390x']

config

test

  • Description: Closure that takes a single parameter of type com.redhat.multiarch.ci.provisioner.Host and wraps your test.
  • Type: Closure

onTestFailure

  • Description: Closure that takes a two parameters. The first is of type com.redhat.multiarch.ci.provisioner.Host, and the second is of type Exception. This is called in the situation that your test closure fails.
  • Type: Closure

postTest

  • Description: Closure that is run after the individual arch tests. It runs in its own provisioning container. It takes no parameters, and does nothing by default.
  • Optional: true
  • Type: Closure

TestUtils.testWrapper

If the arch test specific functions don't solve you use case, you can use test wrapper to spin up a provisioning container and run a closure on it. The function is available in release v1.0 and above.

This function has 3 parameters.

script

  • Description: Usually this is just the "this" object of your test. It gives the library access to pipeline steps such as sh.
  • Type: WorkflowScript

config

test

  • Description: Closure that takes no parameters and wraps your test.
  • Type: Closure

Pipeline Steps

These pipeline steps were added in v1.0 to increase the ease of common functions used alongside the Test Template.

archiveOutput

This step was added in release v1.0 to simplify the archiving of ansible and script tests.

This step takes no arguments.

downloadTests

This step was adding in release v1.0 to simplify the downloading of ansible and script tests.

This step takes no arguments.

getRPMFromCIMessage

getTaskId

installBrewPkgs

runTests

This step was adding in release v1.0 to simplify the running of ansible and script tests.

This step takes two arguments.

config

host

  • Description: The provisioned host object. See Provisioning Output
  • Type: com.redhat.multiarch.ci.provisioner.Host
Clone this wiki locally