curl commands.
What You Will Learn
- How to verify HTTP response codes and payloads with
curl - Embedding integration tests in a Jenkinsfile
- Rolling back failed deployments automatically
Why Integration Testing Matters
Integration testing catches issues that unit tests cannot, such as network connectivity, misconfigured services, or data serialization errors. For a REST API, common checks include:- HTTP status codes
- Response headers
- Payload validation (JSON, XML, or plain text)
Architecture Overview
Our demo application consists of two microservices:- A Spring Boot service listening on a NodePort (e.g.,
31933) - A Node.js service that processes business logic
curl-based tests:
- Check that
/increment/99returns HTTP 200 - Confirm payload increments 99 to 100

Manual Curl Commands
Use these commands for a quick sanity check:Embedding Integration Tests in Jenkins Pipeline
Add a dedicatedIntegration Test - DEV stage right after deploying to Kubernetes. The stage will:
- Execute
integration-test.shforcurl-based checks - Automatically roll back on failure using
kubectl rollout undo
Jenkins Pipeline Stages at a Glance
Jenkinsfile Snippet
Ensure that the
serviceName environment variable matches your Kubernetes Deployment name. Replace ${serviceName} if needed.integration-test.sh Script
Create anintegration-test.sh file with executable permissions (chmod +x integration-test.sh):
Local Testing
Before committing to Jenkins, validate tests locally:200 and 100, your integration test script is working.
After pushing changes, Jenkins will run the updated pipeline, including the new integration test stage.
