Skip to content

feat: add dmt test#326

Draft
timmilesdw wants to merge 1 commit intomainfrom
feat/dmt-test
Draft

feat: add dmt test#326
timmilesdw wants to merge 1 commit intomainfrom
feat/dmt-test

Conversation

@timmilesdw
Copy link

@timmilesdw timmilesdw commented Dec 19, 2025

Add dmt test command with conversions testing support

Summary

This PR introduces a new dmt test command that provides a testing framework for Deckhouse modules. The first implemented test type is conversions testing, allowing module developers to verify that config version migrations work correctly.

Problem

Currently, conversion tests exist only inside the deckhouse repo. External module developers have no way to test their conversions locally before deploying. This creates a risk of broken config migrations in production.

Solution

Added extensible testing infrastructure with the following components:

  • dmt test <module-path> , new CLI command to run module tests
  • Conversions tester, validates that jq-based config conversions produce expected results
  • YAML test contract, simple format for defining test cases

Usage

# Run tests for a module
dmt test ./my-module

# Run only conversion tests
dmt test ./my-module --type conversions

Test Contract

Create openapi/conversions/conversions_test.yaml in your module:

cases:
  - name: "should migrate skipThreshold to timeout"
    currentVersion: 1
    expectedVersion: 2
    settings: |
      skipThreshold: 30
    expected: |
      timeout: 30

Architecture

The testing framework is designed to be extensible:

internal/test/
├── runner.go              # Core runner with Tester interface
└── conversions/
    └── conversions.go     # Conversions test implementation

Adding new test types requires implementing the Tester interface:

type Tester interface {
    Type() TestType
    CanRun(modulePath string) bool
    Run(modulePath string) (*TestSuiteResult, error)
}

@timmilesdw timmilesdw self-assigned this Dec 19, 2025
@timmilesdw timmilesdw added the enhancement New feature or request label Dec 19, 2025
Signed-off-by: Timur Tuktamyshev <timur.tuktamyshev@flant.com>
@@ -0,0 +1,274 @@
/*
Copyright 2025 Flant JSC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments