Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 2.32 KB

test_strategy.md

File metadata and controls

52 lines (41 loc) · 2.32 KB

Test strategy

Design test

These are the checks and tests encouraged to be provided and maintained by the developers of a given operator. This is intentionally focusing on the bottom of the test pyramid.

  1. A common set of static analysis tools, stylers, linters aggregated into a single pre-commit run both locally and in CI:

    • go standard tools: fmt, vet, mod tidy
    • golangci-lint: a meta linter with a tons of linters included but only a small subset enabled by default
    • operator-lint: a home grew linter automating operator development and testing specific rules

    Each operator can extend the list of linters but we need a common minimum set across each operators.

  2. Unit tests covering functions or types using go’s standard testing lib and gomega

  3. Component tests (also called functional or service tests) covering the reconciliation of a single CRD or a set of CRDs from the same operator using EnvTest

  4. Integration test using kuttl on OCP

    • Covering a single operator and its dependencies (e.g. placement-operator tests will depend on keystone-operator and mariadb-operator)
    • Covering our integrated set of operators via openstack-operator

Repository specific rules

nova-operator

  • Each PR changing implementation logic have to include relevant EnvTest coverage

infra-operator

  • Each PR changing implementation logic targeting the network controllers have to include relevant EnvTest coverage.

lib-common

  • Adding new functionality needs

    • either EnvTest coverage if the logic is calling k8s APIs. For example job
    • or unit test coverage if it isn't calling k8s APIs. For example conditions

    Except for the test and test-operators modules as they are test helpers already.