rct

package
v1.74.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 7 Imported by: 0

README

Package rct

Пакет rct предназначен для тестирования схемы и валидации удалённой конфигурации, используемой с isp-kit.

Functions

Test[T any](t *testing.T, defaultRemoteConfigPath string, remoteConfig T)

Проверяет, что удалённая конфигурация соответствует сгенерированной JSON-схеме и проходит валидацию.

  • Проверяет соответствие структуры JSON-схеме
  • Выполняет валидацию значений с помощью validator.Default

Usage

Example usage in test
package mypkg_test

import (
	"testing"

	"github.com/txix-open/isp-kit/rct"
)

type RemoteCfg struct {
	Name string `json:"name" validate:"required"`
}

func TestRemoteCfg(t *testing.T) {
	rct.Test(t, "conf/default_remote_config.json", RemoteCfg{})
}

Documentation

Overview

Package rct provides test helpers for remote configuration validation. It validates that configuration structures match their JSON schemas and can be properly unmarshaled from configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Test

func Test[T any](t *testing.T, defaultRemoteConfigPath string, remoteConfig T)

Test validates that the provided configuration structure matches its generated JSON schema and can be properly unmarshaled from the default configuration file. It also verifies that the configuration passes validator tag validation.

The function checks:

  • The default configuration file is valid against the generated schema
  • The configuration can be unmarshaled from the file
  • The configuration passes validation

nolint:lll

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL