Skip to content

Latest commit

 

History

History
93 lines (73 loc) · 7.26 KB

TESTING.md

File metadata and controls

93 lines (73 loc) · 7.26 KB

Running enmasse test suite

This document gives a detailed breakdown of the testing processes and testing options for EnMasse within system tests.

Setting up test environment

To run any system tests you need a Kubernetes or Openshift cluster available in your active kubernetes context. You can use minikube, minishift, oc cluster up or CodeReady Contaners to have access to a cluster on your local machine. You can also access a remote cluster on any machine you want. Make sure oc/kubectl is logged in to your cluster with cluster-admin privileges. However you should not run the tests with system:admin user. You can give the privileges to a standard user :

oc login -u system:admin https://localhost:8443
oc adm policy add-cluster-role-to-user cluster-admin developer
oc login -u developer -p developer https://localhost:8443

Systemtests framework installs enmasse and iot operators by default with latest templates and images, you can also generate templates yourself into templates/build/enmasse-latest or you can use downloaded templates of release, in this case you need to provide custom path to your install bundle via env variable TEMPLATES

Generate templates

make templates

Provide custom template path

export TEMPLATES="/path/to/your/install/bundle"

Running all tests

make PROFILE=${PROFILE} systemtests

Running a single test class

make PROFILE=${PROFILE} TESTCASE="**.MessagingEndpointTest" systemtests

Where $PROFILE can be:

  • systemtests
  • acceptance
  • iot
  • scale

Test process

  1. Tests are stored into TestPlan
  2. OperatorManager installs enmasse operator, example plans, example auth services and roles (if test is iot is also deploy iot components).
  3. Test is triggered and evaluated.
  4. If test is latest OperatorManager uninstall operators and clean kubernetes env, else continue with step 2.

Creating test cases

  • Decide if you can create test under existing test class here or create a new one.
  • Create @Test method:
    • Every test method should pass junit ExtensionContext by default so your test declaration should be void testFoo(ExtensionContext extensioncontext)...
    • Create resources using builders (MessagingInfrastructureBuilder, MessagingProjectBuilder etc...) from api-model or you can use default infra and project by using annotations @DefaultMessagingInfrastructure and @DefaulMessagingtProject
    • call resourceManager methods for creating enmasse resources in kubernetes cluster resourceManager.create(extensionConstext, infra, project)
    • do test code
  • You don't need to take care about removing resources, Test callbacks do that after every test

Available env variable for systemtests

We can configure our system tests with several environment variables, which are loaded before test execution. All environment variables can be seen in Environment class:

Name Description Default
TEST_LOGDIR Folder where log information and kubernetes state are stored /tmp/testlogs
KUBERNETES_NAMESPACE kubernetes namespace where enmasse infra is deployed enmasse-infra
KUBERNETES_API_URL kubernetes api url got from actual context
KUBERNETES_API_TOKEN kubernetes token of cluster-admin user got from actual context
KUBERNETES_DOMAIN dns domain name of kubernetes cluster nip.io
KUBERNETES_API_CONNECT_TIMEOUT kuberntes api connection timeout 60
KUBERNETES_API_READ_TIMEOUT kuberntes api connection timeout 60
KUBERNETES_API_WRITE_TIMEOUT kuberntes api connection timeout 60
UPGRADE_TEMPLATES path for upgrade templates ${ENMASSE_DIR}/templates/build/enmasse-latest
START_TEMPLATES path for start templates before upgrade ${ENMASSE_DIR}/templates/build/enmasse-latest
TEMPLATES path where templates are stored ${ENMASSE_DIR}/templates/build/enmasse-latest
SKIP_CLEANUP skip teardown and uninstall phase of tests (for debug only) false
SKIP_UNINSTALL skip enmassse operator uninstall (for debug purpose) false
STORE_SCREENSHOTS store screenshots in selenium tests even if test failed or not false
MONITORING_NAMESPACE Inamespace for install monitoring part of enmasse enmasse-monitoring
TAG tag of images latest
PRODUCT_NAME name of product enmasse
INSTALL_TYPE type of installation enmasse operator BUNDLE
OLM_INSTALL_TYPE type of olm installation enmasse operator SPECIFIC
SKIP_DEPLOY_INFINISPAN skip deployment of infinispan iot component false
INFINISPAN_PROJECT project where infinispan deployment is deployed systemtests-infinispan