MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / authServer

Method authServer

e2e_framework_test.go:454–482  ·  view source on GitHub ↗
(t *testing.T, userdb AuthUserStorage, port int)

Source from the content-addressed store, hash-verified

452}
453
454func (c *testContext) authServer(t *testing.T, userdb AuthUserStorage, port int) {
455 srv, err := webhook.NewServer(
456 config.HTTPServerConfiguration{
457 Listen: fmt.Sprintf("127.0.0.1:%d", port),
458 },
459 &authHandler{
460 userdb: userdb,
461 },
462 log.NewTestLogger(t),
463 )
464 if err != nil {
465 t.Fatalf("Failed to start authentication webhook server. (%v)", err)
466 }
467 lifecycle := service.NewLifecycle(srv)
468 go func() {
469 _ = lifecycle.Run()
470 }()
471
472 t.Cleanup(func() {
473 shutdownContext, cancel := context.WithTimeout(context.Background(), 30*time.Second)
474 defer cancel()
475 lifecycle.Stop(shutdownContext)
476
477 lastError := lifecycle.Wait()
478 if lastError != nil {
479 t.Fatalf("Failed to stop authentication webhook server. (%v)", lastError)
480 }
481 })
482}
483
484// AuthUser is an entry in the in-memory AuthUserStorage. It can be used to modify the user used for testing.
485type AuthUser interface {

Callers 1

StartContainerSSHMethod · 0.95

Calls 8

RunMethod · 0.95
StopMethod · 0.95
WaitMethod · 0.95
NewServerFunction · 0.92
NewTestLoggerFunction · 0.92
NewLifecycleFunction · 0.92
FatalfMethod · 0.80
CleanupMethod · 0.80

Tested by

no test coverage detected