liveBook · Manning

Reliability

As explained in Data-Oriented Programming in Java

Software reliability is the likelihood that software continues to perform required functions correctly under stated conditions.

Software reliability is the likelihood that software continues performing required functions correctly under stated conditions. Integration tests protect it by exercising real service boundaries, where networks, outages, races, and corrupted data can expose failures that unit tests miss. section 12.0 section 12.6

A reliable integration suite must be trustworthy itself. Fixed shared infrastructure lets tests interfere with one another, producing mysterious failures and weakening confidence in the software. section 12.6

Build reliability into integration testing by:

  • Provisioning queues, buckets, and other dependencies on demand for each test. section 12.6
  • Injecting those isolated dependencies into the service rather than pointing tests at fixed environments. section 12.6
  • Randomizing resource names so prior failures cannot collide with later tests. section 12.6
  • Using namespaces to support cleanup at test, suite, owner, or global scope. section 12.6

An isolated integration test

Create input and output queues plus a bucket immediately before the test, construct the service with those dependencies, run the service, assert its behavior, and tear the resources down afterward. A randomized namespace prevents collisions with other tests.

Listing 12.13 Creating isolated dependencies for a test
@Test
void myCoolIntegrationTest () {
  // spinning up infrastructure right before we run the test
  Queue inputQueue = cloudSDK.createQueue("my-own-input-queue");
  Queue outputQueue = cloudSDK.createQueue("my-own-output-queue"); 
  Bucket bucket = cloudSDK.createBucket("bucket-for-my-test"); 

  // We construct our service using the placeholder infrastructure. 
  // (This, of course, depends on us using good Dependency 
  //  Injection practices)
  MyService service = new MyService(inputQueue, outputQueue, bucket);
  // now it’s pretty standard arrange, act, assert.
  // just that the “arrange” is done against service infrastructure 
  // that’s completely isolated to our test
  inputQueue.put(makeInputMessage());
  
  service.run()

  // then we make sure everything behaved the way we expect. 
  // for instance, the item in the input queue should have been consumed
  assertEquals(inputQueue.poll(), Optional.empty());
  // we want something in the output queue 
  assertNotEquals(outputQueue.poll(), Optional.empty());
  // and something written to our bucket 
  assertEquals(/* lookup item in bucket here */); 

  // then blow everything away 
  cloudSDK.deleteQueue(inputQueue.name());
  cloudSDK.deleteQueue(outputQueue.name());
  cloudSDK.deleteBucket(bucket.name());
}

Shows the small setup, dependency injection, exercise, and assertion pattern used to isolate real infrastructure for an integration test. section 12.6

How Data-Oriented Programming in Java covers it

How deep it goes
Explains infrastructure provisioning, injection, random naming, namespaced cleanup, and test interference, but stops short of reliability measurement.
Examples
Demonstrates queues, buckets, randomized names, namespaces, cleanup helpers, and a service tested against ephemeral infrastructure.
What it assumes
Assumes integration testing and cloud-service familiarity while making isolation, dependency injection, and cleanup practices explicit.
What you can do after
Build isolated integration suites that exercise real services while reducing cross-test interference and cleanup failures.
How it connects
Connects reliability with integration testing, test isolation, dependency injection, distributed systems, and eventual consistency.

Also explained in

Compare how 21 books explain reliability →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Oriented Programming in Java. The section links point to the parts of the book it draws on.