package debug

import "github.com/containernetworking/cni/plugins/test/noop/debug"

debug supports tests that use the noop plugin

Index

Constants

const EmptyReportResultMessage = "set debug.ReportResult and call debug.WriteDebug() before calling this plugin"

Functions

func WriteCommandLog

func WriteCommandLog(path string, entry CmdLogEntry) error

WriteCommandLog appends the executed cni command to the record file

Types

type CmdLog

type CmdLog []CmdLogEntry

CmdLog records a list of CmdLogEntry received by the noop plugin

func ReadCommandLog

func ReadCommandLog(path string) (CmdLog, error)

type CmdLogEntry

type CmdLogEntry struct {
	Command string
	CmdArgs skel.CmdArgs
}

CmdLogEntry records a single CNI command as well as its args

type Debug

type Debug struct {
	// Report* fields allow the test to control the behavior of the no-op plugin
	ReportResult         string
	ReportError          string
	ReportErrorCode      uint
	ReportStderr         string
	ReportVersionSupport []string
	ExitWithCode         int

	// Command stores the CNI command that the plugin received
	Command string

	// CmdArgs stores the CNI Args and Env Vars that the plugin received
	CmdArgs skel.CmdArgs
}

Debug is used to control and record the behavior of the noop plugin

func ReadDebug

func ReadDebug(debugFilePath string) (*Debug, error)

ReadDebug will return a debug file recorded by the noop plugin

func (*Debug) WriteDebug

func (debug *Debug) WriteDebug(debugFilePath string) error

WriteDebug will create a debug file to control the noop plugin

Source Files

debug.go

Version
v1.3.0 (latest)
Published
Apr 7, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
4 days ago

Tools for package owners.