Documentation
¶
Overview ¶
Package v1beta1test provides test fixture builders for the v1beta1 operator API types. It is a companion to the api/v1beta1 package (in the spirit of the standard library's net/http + net/http/httptest split): the builders live next to the types they construct, but stay out of the production API surface because only *_test.go files import this package.
The builders apply sensible test defaults and expose functional options for the high-frequency fields only. Rare or one-off spec shapes should still be written as inline literals at the call site rather than growing the option set here.
Index ¶
- func NewEmbeddingServer(name, namespace string, opts ...EmbeddingServerOption) *mcpv1beta1.EmbeddingServer
- func NewMCPRemoteProxy(name, namespace string, opts ...MCPRemoteProxyOption) *mcpv1beta1.MCPRemoteProxy
- func NewMCPServer(name, namespace string, opts ...MCPServerOption) *mcpv1beta1.MCPServer
- func NewVirtualMCPServer(name, namespace string, opts ...VirtualMCPServerOption) *mcpv1beta1.VirtualMCPServer
- type EmbeddingServerOption
- func MutateEmbedding(fn func(*mcpv1beta1.EmbeddingServer)) EmbeddingServerOption
- func WithEmbeddingArgs(args ...string) EmbeddingServerOption
- func WithEmbeddingDeletionTimestamp(ts metav1.Time, finalizers ...string) EmbeddingServerOption
- func WithEmbeddingEnv(env ...mcpv1beta1.EnvVar) EmbeddingServerOption
- func WithEmbeddingHFTokenSecretRef(ref *mcpv1beta1.SecretKeyRef) EmbeddingServerOption
- func WithEmbeddingImage(image string) EmbeddingServerOption
- func WithEmbeddingImagePullPolicy(policy corev1.PullPolicy) EmbeddingServerOption
- func WithEmbeddingModel(model string) EmbeddingServerOption
- func WithEmbeddingModelCache(cfg *mcpv1beta1.ModelCacheConfig) EmbeddingServerOption
- func WithEmbeddingPodTemplateSpec(pts *runtime.RawExtension) EmbeddingServerOption
- func WithEmbeddingPort(port int32) EmbeddingServerOption
- func WithEmbeddingReplicas(replicas int32) EmbeddingServerOption
- func WithEmbeddingStatus(status mcpv1beta1.EmbeddingServerStatus) EmbeddingServerOption
- type MCPRemoteProxyOption
- func MutateRemoteProxy(fn func(*mcpv1beta1.MCPRemoteProxy)) MCPRemoteProxyOption
- func WithRemoteProxyAudit(cfg *mcpv1beta1.AuditConfig) MCPRemoteProxyOption
- func WithRemoteProxyAuthServerRef(kind, name string) MCPRemoteProxyOption
- func WithRemoteProxyAuthzConfig(cfg *mcpv1beta1.AuthzConfigRef) MCPRemoteProxyOption
- func WithRemoteProxyAuthzConfigRef(name string) MCPRemoteProxyOption
- func WithRemoteProxyDeletionTimestamp(ts metav1.Time, finalizers ...string) MCPRemoteProxyOption
- func WithRemoteProxyExternalAuthConfigRef(name string) MCPRemoteProxyOption
- func WithRemoteProxyGroupRef(name string) MCPRemoteProxyOption
- func WithRemoteProxyHeaderForward(cfg *mcpv1beta1.HeaderForwardConfig) MCPRemoteProxyOption
- func WithRemoteProxyOIDCConfigRef(name, audience string) MCPRemoteProxyOption
- func WithRemoteProxyPort(port int32) MCPRemoteProxyOption
- func WithRemoteProxyReplicas(replicas int32) MCPRemoteProxyOption
- func WithRemoteProxyServiceAccount(name string) MCPRemoteProxyOption
- func WithRemoteProxySessionStorage(cfg *mcpv1beta1.SessionStorageConfig) MCPRemoteProxyOption
- func WithRemoteProxyStatus(status mcpv1beta1.MCPRemoteProxyStatus) MCPRemoteProxyOption
- func WithRemoteProxyTelemetryConfigRef(name string) MCPRemoteProxyOption
- func WithRemoteProxyToolConfigRef(name string) MCPRemoteProxyOption
- func WithRemoteProxyTransport(transport string) MCPRemoteProxyOption
- func WithRemoteProxyURL(url string) MCPRemoteProxyOption
- type MCPServerOption
- func Mutate(fn func(*mcpv1beta1.MCPServer)) MCPServerOption
- func WithArgs(args ...string) MCPServerOption
- func WithAudit(cfg *mcpv1beta1.AuditConfig) MCPServerOption
- func WithAuthServerRef(kind, name string) MCPServerOption
- func WithAuthzConfigRef(name string) MCPServerOption
- func WithDeletionTimestamp(ts metav1.Time, finalizers ...string) MCPServerOption
- func WithEnv(env ...mcpv1beta1.EnvVar) MCPServerOption
- func WithExternalAuthConfigRef(name string) MCPServerOption
- func WithImage(image string) MCPServerOption
- func WithMCPGroupRef(name string) MCPServerOption
- func WithMCPPort(port int32) MCPServerOption
- func WithOIDCConfigRef(name, audience string) MCPServerOption
- func WithPodTemplateSpec(pts *runtime.RawExtension) MCPServerOption
- func WithProxyMode(mode string) MCPServerOption
- func WithProxyPort(port int32) MCPServerOption
- func WithReplicas(replicas int32) MCPServerOption
- func WithSessionStorage(cfg *mcpv1beta1.SessionStorageConfig) MCPServerOption
- func WithStatus(status mcpv1beta1.MCPServerStatus) MCPServerOption
- func WithTelemetryConfigRef(name string) MCPServerOption
- func WithToolConfigRef(name string) MCPServerOption
- func WithTransport(transport string) MCPServerOption
- func WithWebhookConfigRef(name string) MCPServerOption
- type VirtualMCPServerOption
- func MutateVMCP(fn func(*mcpv1beta1.VirtualMCPServer)) VirtualMCPServerOption
- func WithVMCPAuthServerConfig(cfg *mcpv1beta1.EmbeddedAuthServerConfig) VirtualMCPServerOption
- func WithVMCPConfig(cfg config.Config) VirtualMCPServerOption
- func WithVMCPDeletionTimestamp(ts metav1.Time, finalizers ...string) VirtualMCPServerOption
- func WithVMCPEmbeddingServerRef(name string) VirtualMCPServerOption
- func WithVMCPGroupRef(name string) VirtualMCPServerOption
- func WithVMCPIncomingAuth(cfg *mcpv1beta1.IncomingAuthConfig) VirtualMCPServerOption
- func WithVMCPOutgoingAuth(cfg *mcpv1beta1.OutgoingAuthConfig) VirtualMCPServerOption
- func WithVMCPPodTemplateSpec(pts *runtime.RawExtension) VirtualMCPServerOption
- func WithVMCPReplicas(replicas int32) VirtualMCPServerOption
- func WithVMCPServiceAccount(name string) VirtualMCPServerOption
- func WithVMCPSessionStorage(cfg *mcpv1beta1.SessionStorageConfig) VirtualMCPServerOption
- func WithVMCPStatus(status mcpv1beta1.VirtualMCPServerStatus) VirtualMCPServerOption
- func WithVMCPTelemetryConfigRef(name string) VirtualMCPServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEmbeddingServer ¶
func NewEmbeddingServer(name, namespace string, opts ...EmbeddingServerOption) *mcpv1beta1.EmbeddingServer
NewEmbeddingServer returns an EmbeddingServer with test defaults (the model, image, and port the suite most commonly uses), customized by the supplied options.
Its options are prefixed Embedding to coexist with the other workload builders in this package, which share field names (Image, Args, Env, Replicas, …) that Go will not let us overload.
func NewMCPRemoteProxy ¶
func NewMCPRemoteProxy(name, namespace string, opts ...MCPRemoteProxyOption) *mcpv1beta1.MCPRemoteProxy
NewMCPRemoteProxy returns an MCPRemoteProxy with test defaults (the most common remote URL and proxy port found in the suite), customized by the supplied options. Transport is intentionally left unset because the vast majority of literals omit it and rely on its zero value.
Its options are prefixed RemoteProxy to coexist with the other workload builders in this package, which share field names (ProxyPort, Transport, Replicas, Status, …) that Go will not let us overload.
func NewMCPServer ¶
func NewMCPServer(name, namespace string, opts ...MCPServerOption) *mcpv1beta1.MCPServer
NewMCPServer returns an MCPServer with test defaults (a stdio server on the default proxy port), customized by the supplied options. The defaults match the values the deleted per-file builders used, so existing tests read the same after migration.
func NewVirtualMCPServer ¶
func NewVirtualMCPServer(name, namespace string, opts ...VirtualMCPServerOption) *mcpv1beta1.VirtualMCPServer
NewVirtualMCPServer returns a VirtualMCPServer with the given name and namespace, customized by the supplied options. Unlike NewMCPServer it sets no spec defaults: VirtualMCPServer has no always-present scalar field (its required GroupRef carries a per-test name), so callers set what they need via the With* options or MutateVMCP.
Its options are prefixed VMCP to coexist with the other workload builders in this package, which share field names (GroupRef, Replicas, Status, …) that Go will not let us overload.
Types ¶
type EmbeddingServerOption ¶
type EmbeddingServerOption func(*mcpv1beta1.EmbeddingServer)
EmbeddingServerOption mutates an EmbeddingServer under construction.
func MutateEmbedding ¶
func MutateEmbedding(fn func(*mcpv1beta1.EmbeddingServer)) EmbeddingServerOption
MutateEmbedding is the escape hatch for spec or metadata fields that have no dedicated option (Resources, ResourceOverrides, metadata.UID/Labels, …). It runs in option order. Prefer a dedicated option when one exists; keep genuinely complex fixtures as inline literals.
func WithEmbeddingArgs ¶
func WithEmbeddingArgs(args ...string) EmbeddingServerOption
WithEmbeddingArgs sets the inference server args.
func WithEmbeddingDeletionTimestamp ¶
func WithEmbeddingDeletionTimestamp(ts metav1.Time, finalizers ...string) EmbeddingServerOption
WithEmbeddingDeletionTimestamp marks the server as being deleted (with the given finalizers so the fake client accepts the non-zero timestamp).
func WithEmbeddingEnv ¶
func WithEmbeddingEnv(env ...mcpv1beta1.EnvVar) EmbeddingServerOption
WithEmbeddingEnv replaces the environment variables.
func WithEmbeddingHFTokenSecretRef ¶
func WithEmbeddingHFTokenSecretRef(ref *mcpv1beta1.SecretKeyRef) EmbeddingServerOption
WithEmbeddingHFTokenSecretRef sets the HuggingFace token secret reference.
func WithEmbeddingImage ¶
func WithEmbeddingImage(image string) EmbeddingServerOption
WithEmbeddingImage overrides the container image.
func WithEmbeddingImagePullPolicy ¶
func WithEmbeddingImagePullPolicy(policy corev1.PullPolicy) EmbeddingServerOption
WithEmbeddingImagePullPolicy sets the image pull policy.
func WithEmbeddingModel ¶
func WithEmbeddingModel(model string) EmbeddingServerOption
WithEmbeddingModel overrides the HuggingFace embedding model.
func WithEmbeddingModelCache ¶
func WithEmbeddingModelCache(cfg *mcpv1beta1.ModelCacheConfig) EmbeddingServerOption
WithEmbeddingModelCache sets the model cache configuration.
func WithEmbeddingPodTemplateSpec ¶
func WithEmbeddingPodTemplateSpec(pts *runtime.RawExtension) EmbeddingServerOption
WithEmbeddingPodTemplateSpec sets the raw pod template spec override.
func WithEmbeddingPort ¶
func WithEmbeddingPort(port int32) EmbeddingServerOption
WithEmbeddingPort overrides the service port.
func WithEmbeddingReplicas ¶
func WithEmbeddingReplicas(replicas int32) EmbeddingServerOption
WithEmbeddingReplicas sets the desired replica count.
func WithEmbeddingStatus ¶
func WithEmbeddingStatus(status mcpv1beta1.EmbeddingServerStatus) EmbeddingServerOption
WithEmbeddingStatus replaces the EmbeddingServer status.
type MCPRemoteProxyOption ¶
type MCPRemoteProxyOption func(*mcpv1beta1.MCPRemoteProxy)
MCPRemoteProxyOption mutates an MCPRemoteProxy under construction.
func MutateRemoteProxy ¶
func MutateRemoteProxy(fn func(*mcpv1beta1.MCPRemoteProxy)) MCPRemoteProxyOption
MutateRemoteProxy is the escape hatch for spec or metadata fields that have no dedicated option (Resources, ResourceOverrides, EndpointPrefix, TrustProxyHeaders, SessionAffinity, metadata.UID/Labels, …). It runs in option order. Prefer a dedicated option when one exists; keep genuinely complex fixtures as inline literals.
func WithRemoteProxyAudit ¶
func WithRemoteProxyAudit(cfg *mcpv1beta1.AuditConfig) MCPRemoteProxyOption
WithRemoteProxyAudit sets the audit configuration.
func WithRemoteProxyAuthServerRef ¶
func WithRemoteProxyAuthServerRef(kind, name string) MCPRemoteProxyOption
WithRemoteProxyAuthServerRef sets the embedded auth-server reference by kind and name.
func WithRemoteProxyAuthzConfig ¶
func WithRemoteProxyAuthzConfig(cfg *mcpv1beta1.AuthzConfigRef) MCPRemoteProxyOption
WithRemoteProxyAuthzConfig sets the inline authorization configuration.
func WithRemoteProxyAuthzConfigRef ¶
func WithRemoteProxyAuthzConfigRef(name string) MCPRemoteProxyOption
WithRemoteProxyAuthzConfigRef sets the MCPAuthzConfig reference by name.
func WithRemoteProxyDeletionTimestamp ¶
func WithRemoteProxyDeletionTimestamp(ts metav1.Time, finalizers ...string) MCPRemoteProxyOption
WithRemoteProxyDeletionTimestamp marks the proxy as being deleted (with the given finalizers so the fake client accepts the non-zero timestamp).
func WithRemoteProxyExternalAuthConfigRef ¶
func WithRemoteProxyExternalAuthConfigRef(name string) MCPRemoteProxyOption
WithRemoteProxyExternalAuthConfigRef sets the MCPExternalAuthConfig reference by name.
func WithRemoteProxyGroupRef ¶
func WithRemoteProxyGroupRef(name string) MCPRemoteProxyOption
WithRemoteProxyGroupRef sets the MCPGroup the proxy belongs to.
func WithRemoteProxyHeaderForward ¶
func WithRemoteProxyHeaderForward(cfg *mcpv1beta1.HeaderForwardConfig) MCPRemoteProxyOption
WithRemoteProxyHeaderForward sets the header-forward configuration.
func WithRemoteProxyOIDCConfigRef ¶
func WithRemoteProxyOIDCConfigRef(name, audience string) MCPRemoteProxyOption
WithRemoteProxyOIDCConfigRef sets the MCPOIDCConfig reference by name and audience.
func WithRemoteProxyPort ¶
func WithRemoteProxyPort(port int32) MCPRemoteProxyOption
WithRemoteProxyPort overrides the proxy port.
func WithRemoteProxyReplicas ¶
func WithRemoteProxyReplicas(replicas int32) MCPRemoteProxyOption
WithRemoteProxyReplicas sets the desired replica count.
func WithRemoteProxyServiceAccount ¶
func WithRemoteProxyServiceAccount(name string) MCPRemoteProxyOption
WithRemoteProxyServiceAccount sets the service account name.
func WithRemoteProxySessionStorage ¶
func WithRemoteProxySessionStorage(cfg *mcpv1beta1.SessionStorageConfig) MCPRemoteProxyOption
WithRemoteProxySessionStorage sets the session storage configuration.
func WithRemoteProxyStatus ¶
func WithRemoteProxyStatus(status mcpv1beta1.MCPRemoteProxyStatus) MCPRemoteProxyOption
WithRemoteProxyStatus replaces the MCPRemoteProxy status.
func WithRemoteProxyTelemetryConfigRef ¶
func WithRemoteProxyTelemetryConfigRef(name string) MCPRemoteProxyOption
WithRemoteProxyTelemetryConfigRef sets the MCPTelemetryConfig reference by name.
func WithRemoteProxyToolConfigRef ¶
func WithRemoteProxyToolConfigRef(name string) MCPRemoteProxyOption
WithRemoteProxyToolConfigRef sets the MCPToolConfig reference by name.
func WithRemoteProxyTransport ¶
func WithRemoteProxyTransport(transport string) MCPRemoteProxyOption
WithRemoteProxyTransport sets the transport ("sse" or "streamable-http").
func WithRemoteProxyURL ¶
func WithRemoteProxyURL(url string) MCPRemoteProxyOption
WithRemoteProxyURL overrides the remote MCP server URL.
type MCPServerOption ¶
type MCPServerOption func(*mcpv1beta1.MCPServer)
MCPServerOption mutates an MCPServer under construction.
func Mutate ¶
func Mutate(fn func(*mcpv1beta1.MCPServer)) MCPServerOption
Mutate is the escape hatch for spec or metadata fields that have no dedicated option (AuthzConfig, ResourceOverrides, Secrets, Volumes, metadata.UID/Generation, …). It applies in argument order like any other option — pass it last if it must override earlier typed options. Prefer a dedicated option when one exists; reach for Mutate only for the less common fields, and keep genuinely complex fixtures as inline literals rather than threading everything through here.
func WithAudit ¶
func WithAudit(cfg *mcpv1beta1.AuditConfig) MCPServerOption
WithAudit sets the audit configuration.
func WithAuthServerRef ¶
func WithAuthServerRef(kind, name string) MCPServerOption
WithAuthServerRef sets the embedded auth-server reference by kind and name (e.g. kind "MCPExternalAuthConfig" or "Secret").
func WithAuthzConfigRef ¶
func WithAuthzConfigRef(name string) MCPServerOption
WithAuthzConfigRef sets the MCPAuthzConfig reference by name.
func WithDeletionTimestamp ¶
func WithDeletionTimestamp(ts metav1.Time, finalizers ...string) MCPServerOption
WithDeletionTimestamp marks the server as being deleted (with the given finalizers so the fake client accepts the non-zero timestamp).
func WithEnv ¶
func WithEnv(env ...mcpv1beta1.EnvVar) MCPServerOption
WithEnv replaces the environment variables.
func WithExternalAuthConfigRef ¶
func WithExternalAuthConfigRef(name string) MCPServerOption
WithExternalAuthConfigRef sets the MCPExternalAuthConfig reference by name.
func WithImage ¶
func WithImage(image string) MCPServerOption
WithImage overrides the container image.
func WithMCPGroupRef ¶
func WithMCPGroupRef(name string) MCPServerOption
WithMCPGroupRef sets the MCPGroup the server belongs to.
func WithMCPPort ¶
func WithMCPPort(port int32) MCPServerOption
WithMCPPort sets the MCP container port.
func WithOIDCConfigRef ¶
func WithOIDCConfigRef(name, audience string) MCPServerOption
WithOIDCConfigRef sets the MCPOIDCConfig reference by name and audience.
func WithPodTemplateSpec ¶
func WithPodTemplateSpec(pts *runtime.RawExtension) MCPServerOption
WithPodTemplateSpec sets the raw pod template spec override.
func WithProxyMode ¶
func WithProxyMode(mode string) MCPServerOption
WithProxyMode overrides the proxy mode (e.g. "sse", "streamable-http").
func WithProxyPort ¶
func WithProxyPort(port int32) MCPServerOption
WithProxyPort overrides the proxy port.
func WithReplicas ¶
func WithReplicas(replicas int32) MCPServerOption
WithReplicas sets the desired replica count.
func WithSessionStorage ¶
func WithSessionStorage(cfg *mcpv1beta1.SessionStorageConfig) MCPServerOption
WithSessionStorage sets the session storage configuration.
func WithStatus ¶
func WithStatus(status mcpv1beta1.MCPServerStatus) MCPServerOption
WithStatus replaces the MCPServer status.
func WithTelemetryConfigRef ¶
func WithTelemetryConfigRef(name string) MCPServerOption
WithTelemetryConfigRef sets the MCPTelemetryConfig reference by name.
func WithToolConfigRef ¶
func WithToolConfigRef(name string) MCPServerOption
WithToolConfigRef sets the ToolConfig reference by name.
func WithTransport ¶
func WithTransport(transport string) MCPServerOption
WithTransport overrides the transport (e.g. "stdio", "streamable-http").
func WithWebhookConfigRef ¶
func WithWebhookConfigRef(name string) MCPServerOption
WithWebhookConfigRef sets the MCPWebhookConfig reference by name.
type VirtualMCPServerOption ¶
type VirtualMCPServerOption func(*mcpv1beta1.VirtualMCPServer)
VirtualMCPServerOption mutates a VirtualMCPServer under construction.
func MutateVMCP ¶
func MutateVMCP(fn func(*mcpv1beta1.VirtualMCPServer)) VirtualMCPServerOption
MutateVMCP is the escape hatch for spec or metadata fields that have no dedicated option. It runs in option order. Prefer a dedicated option when one exists; keep genuinely complex fixtures as inline literals.
func WithVMCPAuthServerConfig ¶
func WithVMCPAuthServerConfig(cfg *mcpv1beta1.EmbeddedAuthServerConfig) VirtualMCPServerOption
WithVMCPAuthServerConfig sets the embedded auth-server configuration.
func WithVMCPConfig ¶
func WithVMCPConfig(cfg config.Config) VirtualMCPServerOption
WithVMCPConfig sets the vMCP server configuration.
func WithVMCPDeletionTimestamp ¶
func WithVMCPDeletionTimestamp(ts metav1.Time, finalizers ...string) VirtualMCPServerOption
WithVMCPDeletionTimestamp marks the server as being deleted (with the given finalizers so the fake client accepts the non-zero timestamp).
func WithVMCPEmbeddingServerRef ¶
func WithVMCPEmbeddingServerRef(name string) VirtualMCPServerOption
WithVMCPEmbeddingServerRef sets the EmbeddingServer reference by name.
func WithVMCPGroupRef ¶
func WithVMCPGroupRef(name string) VirtualMCPServerOption
WithVMCPGroupRef sets the MCPGroup the vMCP server aggregates.
func WithVMCPIncomingAuth ¶
func WithVMCPIncomingAuth(cfg *mcpv1beta1.IncomingAuthConfig) VirtualMCPServerOption
WithVMCPIncomingAuth sets the incoming auth configuration.
func WithVMCPOutgoingAuth ¶
func WithVMCPOutgoingAuth(cfg *mcpv1beta1.OutgoingAuthConfig) VirtualMCPServerOption
WithVMCPOutgoingAuth sets the outgoing auth configuration.
func WithVMCPPodTemplateSpec ¶
func WithVMCPPodTemplateSpec(pts *runtime.RawExtension) VirtualMCPServerOption
WithVMCPPodTemplateSpec sets the raw pod template spec override.
func WithVMCPReplicas ¶
func WithVMCPReplicas(replicas int32) VirtualMCPServerOption
WithVMCPReplicas sets the desired replica count.
func WithVMCPServiceAccount ¶
func WithVMCPServiceAccount(name string) VirtualMCPServerOption
WithVMCPServiceAccount sets the service account name.
func WithVMCPSessionStorage ¶
func WithVMCPSessionStorage(cfg *mcpv1beta1.SessionStorageConfig) VirtualMCPServerOption
WithVMCPSessionStorage sets the session storage configuration.
func WithVMCPStatus ¶
func WithVMCPStatus(status mcpv1beta1.VirtualMCPServerStatus) VirtualMCPServerOption
WithVMCPStatus replaces the VirtualMCPServer status.
func WithVMCPTelemetryConfigRef ¶
func WithVMCPTelemetryConfigRef(name string) VirtualMCPServerOption
WithVMCPTelemetryConfigRef sets the MCPTelemetryConfig reference by name.