Level 5: Testing Infrastructure

Apache Tez has one of the most complete test suites in the Hadoop ecosystem: thousands of unit tests, a MiniTezCluster integration harness, and a TestOrderedWordCount end-to-end reference. At this level you will move from reading tests to writing them — adding missing coverage to TestVertexImpl, submitting a real DAG against MiniTezCluster, and finding and fixing a flaky test.

Why testing matters for contributors

Every Tez patch must include either (a) a new test that fails without the patch and passes with it, or (b) a clear justification in the JIRA for why a test is not needed. Committers will block patches that regress existing tests or that add unverified logic.

What this level covers

TopicWhere
MiniTezCluster setup/teardown lifecycleLab 5.1
TestOrderedWordCount as the canonical integration test templateLab 5.1
Adding a missing TestVertexImpl transition testLab 5.2
Writing a full mini-cluster integration test for your own DAGLab 5.3
Identifying, reproducing, and fixing a flaky testLab 5.4

Prerequisites

  • Level 4 complete (you understand VertexImpl state machine and VertexManagerPlugin)
  • Tez source checked out and mvn install -DskipTests succeeded

Test categories and Maven commands

CategoryWhat it testsCommand
UnitSingle class in isolation with mocksmvn test -pl tez-dag -Dtest=TestVertexImpl
Mini-cluster integrationFull AM + YARN + HDFS in-processmvn test -pl tez-tests -Dtest=TestOrderedWordCount
SystemReal cluster (CI only)Not run locally

Key test classes

ClassModuleWhat it covers
TestVertexImpltez-dagVertexImpl state machine, transitions, vertex recovery
TestDAGImpltez-dagDAGImpl state machine, DAG-level events
TestTaskImpltez-dagTaskImpl scheduling, speculation, counters
TestTaskAttemptImpltez-dagTaskAttemptImpl state transitions
TestOrderedWordCounttez-testsEnd-to-end DAG submission against MiniTezCluster
TestMiniTezClusterWithTeztez-testsMulti-DAG runs, recovery, kill scenarios

Expected outcome

By the end of this level you will have:

  1. Run a DAG against MiniTezCluster inside a JUnit test
  2. Added a missing state-machine transition test to TestVertexImpl
  3. Identified and fixed a flaky test (or documented why it flakes)