liveBook · Manning

Integration test

As explained in Effective Platform Engineering

An integration test evaluates whether multiple software or infrastructure components work together correctly through their real interfaces.

An integration test checks that provisioned infrastructure or deployed services behave as intended through their real interfaces. For infrastructure code, the useful question is not whether a cloud API works: it is whether a reusable module creates the resources and configuration its maintainers promised. section 6.3.5

Choose checks that reflect the outcome the pipeline must deliver:

  • For a reusable Terraform module, apply it in a dedicated cloud account or project and verify the resulting resources and configuration. section 6.3.5
  • For an infrastructure change, write a failing check against an acceptance criterion, such as a required subnet-tag naming pattern; apply the code until it passes, then refactor. section 6.3.5
  • For a control-plane service, deploy a pinned version with Helm, then check its health through the Kubernetes API. Repeat tests to catch manual changes outside the pipeline. section 8.3.1 section 6.5

Test a service after deployment

After deploying kube-state-metrics, check that its pod is Running, inspect its startup log, and query its metrics endpoint for expected output. These checks go beyond a successful Helm command: they confirm that the deployed service starts and reports data. section 8.3.1

@test "kube-state-metrics status is Running" {
  run bash -c "kubectl get po -n kube-system -o wide | grep 'kube-state-metrics'"
  [[ "${output}" =~ "Running" ]]
}
@test "kube-state-metrics logs show service has started successfully" {
  run bash -c "kubectl logs deployment/kube-state-metrics
➥ -n kube-system -c kube-state-metrics"
  [[ "${output}" =~ "Started kube-state-metrics self metrics server" ]]
}

The Bash test examples use kubectl to check a pod’s running status and the service’s startup log. section 8.3.1

Test platform behavior from the user’s side as well as the administrator’s: an EKS pipeline can deploy test applications that use platform features in a customer-like manner. Keep these checks in the delivery workflow so configuration errors and unintended changes surface before they undermine trust in the platform. section 7.5 section 6.5

How Effective Platform Engineering covers it

How deep it goes
Develops a test-first infrastructure workflow and shows post-deployment Kubernetes checks, without detailing a complete test suite.
Examples
Uses Terraform resource checks, subnet-tag conventions, kube-state-metrics health checks, and customer-like test applications.
What it assumes
Assumes familiarity with infrastructure pipelines, Terraform modules, and Kubernetes deployments while laying out the test-first workflow.
What you can do after
Apply it via infrastructure and Kubernetes pipelines to verify intended resources, enforce conventions, and check deployed service health.
How it connects
Connects integration testing to test-driven development, Infrastructure as Code, CI pipelines, configuration drift, and Kubernetes deployments.

Also explained in

Compare how 31 books explain integration test →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Platform Engineering. The section links point to the parts of the book it draws on.