framework

package
v0.28.3 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KnownGoroutineLeaks = []goleak.Option{

		goleak.IgnoreTopFunction("context.(*cancelCtx).propagateCancel.func2"),

		goleak.IgnoreTopFunction("google.golang.org/grpc.(*addrConn).resetTransportAndUnlock"),

		goleak.IgnoreTopFunction("google.golang.org/grpc.(*pickerWrapper).pick"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run"),

		goleak.IgnoreTopFunction("google.golang.org/grpc.newClientStreamWithParams.func4"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*serverHandlerTransport).HandleStreams.func1"),

		goleak.IgnoreTopFunction("google.golang.org/grpc.newClientStreamWithParams.func4"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*controlBuffer).get"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*http2Client).keepalive"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*recvBufferReader).readMessageHeader"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*recvBufferReader).readMessageHeaderClient"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*serverHandlerTransport).HandleStreams.func1"),

		goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*serverHandlerTransport).runStream"),

		goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"),

		goleak.IgnoreTopFunction("sync.runtime_notifyListWait"),

		goleak.IgnoreTopFunction("go.etcd.io/etcd/client/v3.(*watchGrpcStream).waitCancelSubstreams.func1.1"),

		goleak.IgnoreTopFunction("go.etcd.io/etcd/client/v3.(*watchGrpcStream).serveSubstream.func1"),

		goleak.IgnoreTopFunction("k8s.io/apimachinery/pkg/util/wait.BackoffUntil"),

		goleak.IgnoreTopFunction("github.com/kcp-dev/kcp/pkg/informer.NewGenericDiscoveringDynamicSharedInformerFactory[...].func3"),

		goleak.IgnoreTopFunction("k8s.io/apiserver/pkg/storage/storagebackend/factory.newETCD3Check.func2"),

		goleak.IgnoreTopFunction("k8s.io/client-go/util/workqueue.(*delayingType[...]).waitingLoop"),

		goleak.IgnoreTopFunction("k8s.io/client-go/util/workqueue.(*Typed[...]).updateUnfinishedWorkLoop"),

		goleak.IgnoreTopFunction("github.com/kcp-dev/apimachinery/v2/third_party/informers.newScopedSharedIndexInformerWithContext.func1"),

		goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"),

		goleak.IgnoreTopFunction("golang.org/x/net/http2.(*serverConn).serve"),

		goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"),

		goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"),
	}

	// 14s as etcd sets a client request timeout of up to 7 seconds when
	// shutting down the server and then starts shutting down everything
	// else.
	// A shorter timespan d would lead to false positives in the tests.
	WaitTime = 14 * time.Second
)
View Source
var ContextRunInProcess kcptestingserver.KcpRunner = func(ctx context.Context, t kcptestingserver.TestingT, cfg kcptestingserver.Config) (<-chan struct{}, error) {
	s := NewInProcessServer(t)
	s.Config = cfg
	s.Start(ctx, t)
	s.Wait(t)
	return s.StopCh, nil
}

Functions

func GoleakWithDefaults

func GoleakWithDefaults(tb testing.TB, in ...goleak.Option)

GoleakWithDefaults verifies that there are no goroutine leaks. Goleak tests cannot be run in parallelized tests.

Types

type InProcessServer

type InProcessServer struct {
	Config kcptestingserver.Config

	Server *kcpserver.Server
	StopCh chan struct{}

	ClientConfig clientcmd.ClientConfig
	// contains filtered or unexported fields
}

func StartTestServer

StartTestServer starts a KCP server for testing purposes.

func (*InProcessServer) Artifact

func (s *InProcessServer) Artifact(t kcptestingserver.TestingT, producer func() (runtime.Object, error))

func (*InProcessServer) BaseConfig

func (*InProcessServer) CADirectory

func (s *InProcessServer) CADirectory() string

func (*InProcessServer) ClientCAUserConfig

func (s *InProcessServer) ClientCAUserConfig(t kcptestingserver.TestingT, config *rest.Config, name string, groups ...string) *rest.Config

func (*InProcessServer) KubeconfigPath

func (s *InProcessServer) KubeconfigPath() string

func (*InProcessServer) Name

func (s *InProcessServer) Name() string

func (*InProcessServer) RESTConfig

func (s *InProcessServer) RESTConfig(t kcptestingserver.TestingT, context string) *rest.Config

func (*InProcessServer) RawConfig

func (s *InProcessServer) RawConfig() (clientcmdapi.Config, error)

func (*InProcessServer) RawConfigFatal

func (*InProcessServer) RootShardSystemMasterBaseConfig

func (s *InProcessServer) RootShardSystemMasterBaseConfig(t kcptestingserver.TestingT) *rest.Config

func (*InProcessServer) ShardNames

func (s *InProcessServer) ShardNames() []string

func (*InProcessServer) ShardSystemMasterBaseConfig

func (s *InProcessServer) ShardSystemMasterBaseConfig(t kcptestingserver.TestingT, shard string) *rest.Config

func (*InProcessServer) Start

func (*InProcessServer) Stop

func (s *InProcessServer) Stop()

func (*InProcessServer) Stopped

func (s *InProcessServer) Stopped() bool

func (*InProcessServer) Wait

Jump to

Keyboard shortcuts

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