Post

03. DevOps about Test

03. DevOps about Test

DevOps about Test


Prerequisites


1. What is Test in DevOps?

The Test phase ensures that the built system behaves correctly, performs as expected, and is safe to deploy.

In DevOps, testing is not a single step. It is a continuous and automated validation process integrated into the pipeline.

Test is the phase where software is validated for correctness, performance, and reliability before deployment.

2. Why Testing is Critical in C++

For C++ systems, testing is especially important because:

  • no runtime safety (compared to managed languages)
  • memory issues can crash the system
  • undefined behavior can silently break logic
  • performance regressions are common

❌ Without proper testing

  • crashes in production
  • memory leaks
  • incorrect results
  • unstable long-running systems
  • hidden performance degradation

✔ With proper testing

  • predictable behavior
  • stable performance
  • safe deployment
  • easier debugging

3. Testing in System

We are testing:

A C++ real-time pipeline

This means testing must cover:

  • correctness (output is valid)
  • performance (latency, throughput)
  • stability (long-running behavior)

4. Types of Testing

4-1. Unit Testing

Test individual components in isolation

Example: Resize Function

1
Frame Resize(const Frame& input);

Test:

  • output dimensions correct
  • no data corruption
  • edge cases handled
✔ Characteristics
  • fast
  • isolated
  • deterministic

4-2. Integration Testing

Test interaction between modules

Example
1
FrameSource → Preprocessor → Output Queue

Test:

  • correct data flow
  • no deadlocks
  • proper synchronization

4-3. Performance Testing (Critical for C++)

Measure:

  • latency per frame
  • throughput (FPS)
  • CPU usage
Example
1
2
3
Target:
Latency < 10 ms
Throughput > 100 FPS

If performance fails, the system is not acceptable

4-4. Stress / Load Testing

Test system under heavy load

Examples:

  • high frame rate input
  • burst traffic
  • large image sizes

Test for:

  • system slowdown
  • crashes
  • queue overflow

4-5. Stability / Soak Testing

Run system for long periods

Example:

1
Run for 24–72 hours continuously

Check:

  • memory leaks
  • performance degradation
  • resource exhaustion

Critical for production systems

5. Test Automation in DevOps

Testing must be automated.

CI Pipeline Example

1
2
3
4
5
6
7
8
9
Code Push
   ↓
Build
   ↓
Run Unit Tests
   ↓
Run Integration Tests
   ↓
Report Results

If tests fail → pipeline stops

6. Test Examples

Example: Google Test

1
2
3
4
5
6
7
8
TEST(ResizeTest, OutputSize)
{
    Frame input{...};
    Frame output = Resize(input);

    EXPECT_EQ(output.width, expected_width);
    EXPECT_EQ(output.height, expected_height);
}

Easy to integrate into CI

Example: Performance Test

1
2
3
4
5
6
7
8
auto start = std::chrono::high_resolution_clock::now();

for (int i = 0; i < 1000; i++)
{
    preprocessor.Process(input, output);
}

auto end = std::chrono::high_resolution_clock::now();

7. Common Mistakes

❌ Only testing correctness

→ ignores performance regression

❌ Testing manually

→ not scalable, not reliable

❌ No edge case testing

→ crashes in production

❌ Ignoring long-running behavior

→ memory leaks appear later

❌ Not integrating tests into CI

→ bugs slip into production

This post is licensed under CC BY 4.0 by the author.