A bunch of stuff to learn quarkus
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Jonathan Christison 6fe78f815c Add in memory messaging test and test basic user-message and timestamp 5 years ago
getting-started Kafka quickstart https://quarkus.io/guides/kafka 5 years ago
quarkus-kafaka-homework Add in memory messaging test and test basic user-message and timestamp 5 years ago
quarkus-quickstarts@d7d286a364 quarkus archtype quickstart 5 years ago
.gitmodules quarkus archtype quickstart 5 years ago
README.md Added lots of JUnit examples 5 years ago

README.md

Terminology

  • SmallRye - Out the box implementation of MicroProfiles, using JBoss stuff for getting up and running, basically "plugins", IBM competitor is openliberty

  • MicroProfile - Eclipse MicroProfile, microservice framework composed of made up of (bare min)

    • JAX-RS - API for creating REST APIs
    • JSON-P - API for processing JSON
    • CDI 2.0 - Glue JAX-RS and JSON-P together dependency injection using java beans, share a class and manage its lifecycle
    • JSON-B - JSON binding (similar to jackson databind)
    • Open Tracing - standardise tracing/logging/profile metadata across a distributed service, provides wire protocol api spec and impl etc
    • Other stuff like Metrics (prometheus), watchdogs, retry, circuit breakers etc
  • Loom - Virtual threads approach to non-blocking IO (as opposed to event-loop)

  • Quarkus

    • ArC - CDI (injection framework), developed from Weld
    • Command mode - terminates exits after run as opposed to normal operation (wait for systemexit or pod to be killed)
  • Jandex - Java annotations indexer (Jason Green dev)

  • mod_cluster - undertow based Load Balancer

  • Hotspot vs Native

    • Hotspot JVM (JIT) (Andrew Dinn in the office... well when theres not a global pandemic)
    • Native via GraalVM (AOT)
  • Testing frameworks

    • JUnit - Main Java testing framework
    • Rest-assured - Test REST APIs
    • Awaitility - Java DSL test framework for async systems
    • FitNesse - A fork of Fit (Framework for Integrated Test) Acceptance testing framework
  • Testing methodologies

    • Smoke testing - Simple tests for build verification eg. does it run without segfault/strack trace
    • Unit testing - Testing class/methods
    • Integration testing - Testing application framed by user scenarios
    • System testing - Holistic blackbox testing between integration components
    • Acceptance testing -
      • User acceptance testing - Factory acceptance testing (FAT), Site acceptance testing (SAT)
      • Operational acceptance testing - Things that allow a system to be maintained, checking of backups, checking of patching mechanisms etc
      • Contractural and regulation acceptance testing - Test against criteria as documented (Prod gatechecks for example)
    • Debugging (not actually testing but relevent experience, from gdb on ChibiOS to intelij)

General Notes

Quarkus built upon VERT-X for non-blocking IO, VERT-X mostly built upon netty, Vert-X provides a 80+ connectors for non-blocking IO like Kafka, mongodb, AMQP etc Quarkus two main deploy modes - native (graalvm) and jvm, some things dont do so well natively

//Mutiny async construct, onItem <- the result, onFailure <- Failed calls
Uni<String> uni
uni.onItem()
.onFailure()

The Job spec

  • Implement test scenarios and develop enterpirse applications for testing
  • Design and develop testing frameworks in Java for various environments, like cloud, multiple operating systems, large clusters, and containers
  • Provide root cause analysis for complex bugs reported by our customers and communicate the impact of these bugs to customers, developers, and support specialists
  • Participate in defining testing strategies
  • Analyze and prioritize the quality risks posed by Red Hat products and determine the tests required to mitigate these risks
  • Serve as an internal advocate for our customers to ensure that the product goes to customers without usability or user experience issues; properly document relevant information
  • Document new bugs and work with project managers and developers on prioritization and a fix
  • Mentor junior team members
  • Constantly learn new things and maintain an overview of current technologies like Java, MicroProfile, and Reactive programming

Technical Job specs

  • Practical experience with Java EE, MicroProfile, or Spring development
  • Experience with testing in Junit or TestNG beyond unit tests
  • Experience with Maven, Git, Jenkins, continuous integration, and pipelines
  • Debugging and performance tuning skills
  • Ability to install and maintain Red Hat Enterprise Linux (RHEL) or UNIX-like operating systems; basic administration skills of Jenkins nodes

Main technologies to learn about

  • Microprofile + SmallRye
  • JUnit
  • TestNG - Many of its features on the roadmap for JUnit 5.x anyway
  • Jenkins, CI, piplines Blue Ocean
  • Maven - Already know most of this
    • Have fixed bugs in maven plugins
    • Used maven extensively in productisation
    • Good knowledge of prod proccess

JUnit5

Architecture

  • Platform - Test engine itself
  • Jupiter - JUnit5 API/Annotations
  • Vintage - API for older JUnit4 tests
  • Ext - 3rd Party extensions (custom API aka SPI)

"No news is good news" - We only care for failures

  • @Test annotation to highlight test method we'd like to run as part of JUnit tests
  • Common assert methods
assertEquals(expected, actual, "Description of failure") // Asserts both values are equal
assertArrayEquals(expectedArray, actualArray) //Verifies each item in the array are equal in the right position/order
assertIterableEquals(expectedArray, actualArray) // Verifies iterables, again equal and in the right position/order
fail() //Always fail... duh
assertAll(
    () -> assertEquals(expected, actual),
    //() -> ...
    )

Surefire plugin in maven to run JUnit tests (thing we always disabled in Prod 😉)

  • Test lifecycle annotations
@BeforeAll //needs to be static method
@AfterAll //needs to be a static method
@BeforeEach
@AfterEach

//eg init a new pojo for each test
class Foo {
    SomePojo pojo;
    @BeforeEach
    void init() {
        pojo = new SomePojo();
    }
}
  • Nested

class Foo {

    @Nested
    class Bar {
        @Test
        @DisplayName("Test Description")
        void dosomething()
        {
            assertEquals(expected, pojo.method(x,y), "Test description");
            assertEquals(Somethinexpected, pojo.method(x), "Test description 2"
        }
        void dosomethingelse()
        {
            assertEquals(expected, pojo.method(x,y), "Test description");
            assertEquals(Somethinexpected, pojo.method(x), "Test description 2"
        }
    }
}
  • Lambda for lazy tests
assertEquals(expected, actual, () -> "big bad string: " + expected + "actual: " + actual) //Will only execute lambda if assert fires
  • Repeated test @RepeatedTest(n) - Repeat a test multiple times (n number of times) has RepetitionInfo

  • @Tag annotation allows running of many or few of multiple tags

  • JUnit provides many providers (injected) eg. RepetitionInfo or testInfo

QE tests

Github

  • Quarkus-startstop - Measures time and memory usage

    • Did something similar when working on opensplice DDS, combined a demo application with measurement output, used to track metrics not perfect as it didn't account for multiple tests/threads running, sort of solved with CPU pinning
  • Quarkus jenkinsfiles - Jenkins pipelines, based on Groovy

  • Openshift test suite - Integration tests for services on openshift

    • Deploys service via openshift YAML e.g. AMQ then tests quarkus application against it
    • Experience with deploying own openshift cluster and apps (Old laptop... still running now just cant access it!)
    • Experience with managing openshift cluster (Qucklabs)
  • Beefy-scenarios -

The plan

  • Understand technologies and terminologies
  • Fire up Quarkus example (hello world)
  • Design an LED conversion proxy for front porch
    • Listen to MQTT broker
    • Possibly use camel k to write mqtt to file or something
    • "Translate" and passthrough to porchLED
    • Write TestNG tests
    • Mockquito

Refs