Globalcode – Open4education
Ensuring software quality on Cloud
Filippe Spolti
Software Engineer
@filippespolti
Ricardo Martinelli
Senior Software Engineer
@rimolive
Globalcode – Open4education
Globalcode – Open4education
Tests...
In Docker images... Functionality
(smoke tests)
CTF CE-ARQ
Globalcode – Open4education
What we test?
Functionalities
Parameterization and configuration
Behavior
Builds (s2i)
Globalcode – Open4education
How to test?
Define what will be tested
New feature?
Regression?
Bug fixes?
Define test scenario
Globalcode – Open4education
Test Scenarios...
How it is:
ENGLISH STYLE
GIVEN SOME CONDITION
WHEN container is started with env
| name | value |
THEN check something
Globalcode – Open4education
Test Scenarios...
Test Scenario Skeleton:
Feature my cool feature
Scenario test my cool feature - it should print Hello and World on logs
Given/When image is built/container is ready
Then container log should contain Hello
And container logs should contain World
Annotations: @OPENSHIFT, @EAP, ETC...
Globalcode – Open4education
What if...
I don’t have the
sentence for my test
scenario?
Easy customization
/ creation of new
sentences
from behave import *
@given('some known state')
def step_impl(context):
set_up(some, state)
Given some known state
And some other known state
When some action is taken
Then some outcome is observed
But some other outcome is not observed
Globalcode – Open4education
Show Time!!
Docker image Testing with CTF
and Behave
Globalcode – Open4education
Smoke Tests
Why test?
Ensure the generated image work as expected
Ensure the feature was correctly configured
Ensure our middleware products run on Cloud
environments
Globalcode – Open4education
Smoke Tests
Why Arquillian?
Testing Framework used in most JBoss projects and Red Hat products
● Highly customized through extensions
● Arquillian Cube
 Docker / Kubernetes / OpenShift
 Continuous development and bug fixes
● Cloud Enablement - Arquillian Extension (CE-ARQ)
Globalcode – Open4education
Smoke Tests
Requirements:
OpenShift
Container Development Kit (CDK) / MiniShift
oc cluster up
OpenShift Online / OpenShift.io
Java 8
Maven 3
Globalcode – Open4education
Smoke Tests
How tests are executed?
Template (OpenShift Application Templates)
Application (OpenShift Quickstarts)
Test classes running locally or remotely
@RunAsClient, or only @Test
"TestRunner Pod" Definition (Container)
Arquillian.xml descriptor
Globalcode – Open4education
Smoke Tests
@RunWith(Arquillian.class)
@Template(url = "https://raw.githubusercontent.com/${template.repository:jboss-openshift}/application-
templates/${template.branch:master}/decisionserver/decisionserver63-basic-s2i.json",
parameters = {
@TemplateParameter(name = "KIE_SERVER_USER", value = "${kie.username:kieserver}"),
@TemplateParameter(name = "KIE_SERVER_PASSWORD", value = "${kie.password:Redhat@123}")
}
)
@OpenShiftResources({
@OpenShiftResource("https://raw.githubusercontent.com/${template.repository:jboss-openshift}/application-
templates/${template.branch:master}/secrets/decisionserver-app-secret.json")
})
public class DecisionServerBasicTest extends DecisionServerTestBase {
...
@RunAsClient
public void testDecisionServerCapabilities() throws MalformedURLException {
checkKieServerCapabilities(getRouteURL(), "BRM");
}
}
Globalcode – Open4education
Show Time!!
Smoke Test
Globalcode – Open4education
References
• https://github.com/Containers-Testing-Framework/ctf-cli
• http://pythonhosted.org/behave/
• https://github.com/arquillian/arquillian-cube
• https://github.com/jboss-openshift/ce-arq
• https://github.com/jboss-openshift/application-templates
• https://github.com/jboss-openshift/ce-testsuite
• https://github.com/jboss-openshift/openshift-quickstarts
• https://github.com/openshift/source-to-image
Globalcode – Open4education
Ensuring Software Quality in the cloud

Ensuring Software Quality in the cloud

  • 1.
    Globalcode – Open4education Ensuringsoftware quality on Cloud Filippe Spolti Software Engineer @filippespolti Ricardo Martinelli Senior Software Engineer @rimolive
  • 2.
  • 3.
    Globalcode – Open4education Tests... InDocker images... Functionality (smoke tests) CTF CE-ARQ
  • 4.
    Globalcode – Open4education Whatwe test? Functionalities Parameterization and configuration Behavior Builds (s2i)
  • 5.
    Globalcode – Open4education Howto test? Define what will be tested New feature? Regression? Bug fixes? Define test scenario
  • 6.
    Globalcode – Open4education TestScenarios... How it is: ENGLISH STYLE GIVEN SOME CONDITION WHEN container is started with env | name | value | THEN check something
  • 7.
    Globalcode – Open4education TestScenarios... Test Scenario Skeleton: Feature my cool feature Scenario test my cool feature - it should print Hello and World on logs Given/When image is built/container is ready Then container log should contain Hello And container logs should contain World Annotations: @OPENSHIFT, @EAP, ETC...
  • 8.
    Globalcode – Open4education Whatif... I don’t have the sentence for my test scenario? Easy customization / creation of new sentences from behave import * @given('some known state') def step_impl(context): set_up(some, state) Given some known state And some other known state When some action is taken Then some outcome is observed But some other outcome is not observed
  • 9.
    Globalcode – Open4education ShowTime!! Docker image Testing with CTF and Behave
  • 10.
    Globalcode – Open4education SmokeTests Why test? Ensure the generated image work as expected Ensure the feature was correctly configured Ensure our middleware products run on Cloud environments
  • 11.
    Globalcode – Open4education SmokeTests Why Arquillian? Testing Framework used in most JBoss projects and Red Hat products ● Highly customized through extensions ● Arquillian Cube  Docker / Kubernetes / OpenShift  Continuous development and bug fixes ● Cloud Enablement - Arquillian Extension (CE-ARQ)
  • 12.
    Globalcode – Open4education SmokeTests Requirements: OpenShift Container Development Kit (CDK) / MiniShift oc cluster up OpenShift Online / OpenShift.io Java 8 Maven 3
  • 13.
    Globalcode – Open4education SmokeTests How tests are executed? Template (OpenShift Application Templates) Application (OpenShift Quickstarts) Test classes running locally or remotely @RunAsClient, or only @Test "TestRunner Pod" Definition (Container) Arquillian.xml descriptor
  • 14.
    Globalcode – Open4education SmokeTests @RunWith(Arquillian.class) @Template(url = "https://raw.githubusercontent.com/${template.repository:jboss-openshift}/application- templates/${template.branch:master}/decisionserver/decisionserver63-basic-s2i.json", parameters = { @TemplateParameter(name = "KIE_SERVER_USER", value = "${kie.username:kieserver}"), @TemplateParameter(name = "KIE_SERVER_PASSWORD", value = "${kie.password:Redhat@123}") } ) @OpenShiftResources({ @OpenShiftResource("https://raw.githubusercontent.com/${template.repository:jboss-openshift}/application- templates/${template.branch:master}/secrets/decisionserver-app-secret.json") }) public class DecisionServerBasicTest extends DecisionServerTestBase { ... @RunAsClient public void testDecisionServerCapabilities() throws MalformedURLException { checkKieServerCapabilities(getRouteURL(), "BRM"); } }
  • 15.
  • 16.
    Globalcode – Open4education References •https://github.com/Containers-Testing-Framework/ctf-cli • http://pythonhosted.org/behave/ • https://github.com/arquillian/arquillian-cube • https://github.com/jboss-openshift/ce-arq • https://github.com/jboss-openshift/application-templates • https://github.com/jboss-openshift/ce-testsuite • https://github.com/jboss-openshift/openshift-quickstarts • https://github.com/openshift/source-to-image
  • 17.