server

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	PowerOffState = "Off"
	PowerOnState  = "On"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection added in v0.5.0

type Collection struct {
	Members []Member `json:"Members"`
}

type Member added in v0.5.0

type Member struct {
	OdataID string `json:"@odata.id"`
}

type MockServer

type MockServer struct {
	// contains filtered or unexported fields
}

func NewMockServer

func NewMockServer(log logr.Logger, addr string, opts ...Option) *MockServer

func (*MockServer) Authenticate added in v0.5.0

func (s *MockServer) Authenticate(username, password string) bool

Authenticate returns true if username/password match the stored account credentials.

func (*MockServer) GetAccountNames added in v0.5.0

func (s *MockServer) GetAccountNames() map[string]struct{}

GetAccountNames returns the set of UserName values currently in the account collection (including any created by tests). Suitable for gomega HaveKey assertions.

func (*MockServer) GetBMCSettingAttr added in v0.5.0

func (s *MockServer) GetBMCSettingAttr(managerID string) map[string]any

GetBMCSettingAttr returns the current BMC Attributes map for the given managerID (e.g. "BMC"). Returns nil if the resource cannot be loaded.

func (*MockServer) ResetAccounts added in v0.5.0

func (s *MockServer) ResetAccounts()

ResetAccounts clears all account-collection overrides (restoring the embedded default collection) and resets the password store to defaults. Call this in AfterEach to ensure a clean slate between account-related tests.

func (*MockServer) ResetBIOSSettings added in v0.5.0

func (s *MockServer) ResetBIOSSettings(systemID string)

ResetBIOSSettings resets the BIOS attribute state on the server to defaults, clearing both current and pending attributes. systemID is the folder name under data/Systems/ (e.g. "437XR1138R2").

func (*MockServer) ResetBMCSettings added in v0.5.0

func (s *MockServer) ResetBMCSettings(managerID string)

ResetBMCSettings resets the BMC attribute state on the server to defaults, clearing both current and pending attributes. managerID is the folder name under data/Managers/ (e.g. "BMC").

func (*MockServer) ResetUpgradeTask added in v0.5.0

func (s *MockServer) ResetUpgradeTask(resourceURIs ...string)

ResetUpgradeTask resets upgrade state on the mock server.

With no arguments it resets everything: the task JSON, any in-flight goroutine, and all System/Manager resources whose firmware version was written by a completed upgrade.

With one or more Redfish resource URIs (e.g. server.Spec.SystemURI or "/redfish/v1/Managers/BMC") it resets only the version field for those specific resources, leaving others untouched. The task JSON is also reset once no upgraded resources remain.

Call this in AfterEach to ensure a clean slate between upgrade-related tests.

func (*MockServer) SetUnavailable added in v0.5.0

func (s *MockServer) SetUnavailable(unavailable bool)

SetUnavailable toggles the simulated-unavailable mode. When true every request returns 503 Service Unavailable, allowing tests to verify BMC connection-error handling.

func (*MockServer) Start

func (s *MockServer) Start(ctx context.Context) error

Start starts the mock server and stops on ctx cancellation.

type Option added in v0.5.0

type Option func(*MockServer)

Option is a functional option for configuring a MockServer.

func WithAuth added in v0.5.0

func WithAuth() Option

WithAuth enables HTTP Basic Auth enforcement on all non-service-root endpoints. By default the mock server accepts all requests without credentials, which is convenient for local development. Pass WithAuth() in unit-test suites to exercise the authentication path.

Jump to

Keyboard shortcuts

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