testutils

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

README

pkg/installer/testutils

This package provides testing utilities for installer package testing.

Purpose

Contains testing utilities and helper functions specifically designed for testing installer packages (kubectl, flux, etc.). This package provides kubeconfig management, temporary file utilities, and testing patterns for installer functionality.

Features

  • Kubeconfig Testing: Helper functions for managing kubeconfig files in tests
  • Temporary File Management: Utilities for creating temporary test files with proper permissions
  • Installation Testing: Common patterns for testing installer functionality
  • File Permission Testing: Utilities for testing file permission scenarios
  • Test Constants: Standard permissions and testing configurations

Usage

import "github.com/devantler-tech/ksail-go/pkg/installer/testutils"

func TestInstaller(t *testing.T) {
    // Create temporary kubeconfig for testing
    kubeconfig := testutils.CreateTempKubeconfig(t, kubeconfigContent)
    defer os.Remove(kubeconfig)

    // Test installer functionality with temporary files
}

Key Components

  • kubeconfig_helpers.go: Kubeconfig testing utilities and helper functions
  • file permissions: Standard file permission constants for testing
  • temporary file management: Helper functions for test file creation

Integration

This package is used by installer packages for testing:

  • pkg/installer/kubectl: kubectl installation testing
  • pkg/installer/flux: Flux installation testing

This ensures consistent testing patterns across all installer functionality.


⬅️ Go Back

Documentation

Overview

Package testutils provides common test utilities for installer packages

Index

Constants

View Source
const (
	// DefaultFilePermissions defines the default permissions for temporary test files.
	DefaultFilePermissions = 0o600
)

Variables

This section is empty.

Functions

func CreateEmptyKubeconfigFile

func CreateEmptyKubeconfigFile(t *testing.T) string

CreateEmptyKubeconfigFile creates a temporary empty kubeconfig file for testing.

func CreateMalformedKubeconfigFile

func CreateMalformedKubeconfigFile(t *testing.T) string

CreateMalformedKubeconfigFile creates a temporary file with malformed YAML for testing.

func CreateValidKubeconfigFile

func CreateValidKubeconfigFile(t *testing.T) string

CreateValidKubeconfigFile creates a temporary valid kubeconfig file for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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