From e96382ebf61609c5182def8418acb9bbe5f8d21d Mon Sep 17 00:00:00 2001 From: Tobias Schuhmacher Date: Fri, 26 Jan 2024 14:24:42 +0100 Subject: [PATCH] adding tobis ideas --- docs/contributor/testing-strategy.md | 32 +++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/contributor/testing-strategy.md b/docs/contributor/testing-strategy.md index c408f599..ef89c213 100644 --- a/docs/contributor/testing-strategy.md +++ b/docs/contributor/testing-strategy.md @@ -1,4 +1,34 @@ -# Testing Strategy +# Testing Strategy Infrastructure-Manager + +## Introduction +This testing strategy outlines the approach and methodologies to be used for testing a Kubernetes project built using the Kubebuilder framework. It includes various levels of testing such as unit testing, integration testing, and end-to-end testing to ensure the stability, reliability, and correctness of the project. +## Testing Levels +1. **Unit Testing:** Writing and executing tests for individual functions, methods, and components to verify their behavior and correctness in isolation. +2. **Integration Testing:** Validating the integration and interaction between different components, modules, and services in the project. +3. **End-to-End Testing:** Testing the application as a whole in a production-like environment, mimicking real-world scenarios to ensure the entire system functions correctly. +## Testing Tools and Frameworks +Use the following tools and frameworks to implement the above-mentioned testing levels: +- **Ginkgo and Gomega**: For writing and executing unit tests with a BDD-style syntax and assertions. +- **Kubebuilder Test Framework**: For creating and executing integration tests that interact with the Kubernetes cluster. +- **Helm**: For deploying and managing test clusters and environments for end-to-end testing. +- **Kubernetes clients for Go**: Use the official Kubernetes client libraries to interact with the Kubernetes API and validate the behavior of the project. +## Testing Approach +### Unit Testing +1. Identify critical functions, methods, and components that require testing. +2. Write unit tests using Ginkgo and Gomega frameworks. +3. Ensure tests cover various scenarios, edge cases, and possible failure scenarios. +4. Test for both positive and negative inputs to validate the expected behavior. +5. Mock external dependencies and use stubs or fakes to isolate the unit under test. +6. Run unit tests periodically during development and before each commit to prevent regressions. +### Integration Testing +1. Create a separate test suite for integration testing. +2. Use the Kubebuilder Test Framework to create test cases that interact with the Kubernetes cluster. +3. Test the interaction and integration of your custom resources, controllers, and other components with the Kubernetes API. +4. Ensure test cases cover various aspects such as resource creation, updating, deletion, and handling of edge cases. +5. Validate the correctness of event handling, reconciliation, and other control logic. +### End-to-End Testing +1. Use Helm to create, deploy, and manage test clusters and environments that closely resemble the + The following CI/CD jobs are a part of the development cycle: