MCPcopy Create free account
hub / github.com/eth-easl/dirigent / TestReconstructionService

Function TestReconstructionService

internal/control_plane/control_plane_test.go:492–560  ·  view source on GitHub ↗

Reconstruction tests

(t *testing.T)

Source from the content-addressed store, hash-verified

490// Reconstruction tests
491
492func TestReconstructionService(t *testing.T) {
493 ctrl := gomock.NewController(t)
494 defer ctrl.Finish()
495
496 logrus.SetLevel(logrus.FatalLevel)
497
498 persistenceLayer := mock_persistence.NewMockPersistenceLayer(ctrl)
499
500 persistenceLayer.EXPECT().GetWorkerNodeInformation(gomock.Any()).DoAndReturn(func(_ context.Context) ([]*proto.WorkerNodeInformation, error) {
501 return make([]*proto.WorkerNodeInformation, 0), nil
502 }).Times(1)
503
504 persistenceLayer.EXPECT().GetServiceInformation(gomock.Any()).DoAndReturn(func(_ context.Context) ([]*proto.ServiceInfo, error) {
505 return []*proto.ServiceInfo{
506 {
507 Name: "1",
508 Image: "",
509 PortForwarding: nil,
510 AutoscalingConfig: nil,
511 },
512 {
513 Name: "2",
514 Image: "",
515 PortForwarding: nil,
516 AutoscalingConfig: nil,
517 },
518 {
519 Name: "3",
520 Image: "",
521 PortForwarding: nil,
522 AutoscalingConfig: nil,
523 },
524 {
525 Name: "4",
526 Image: "",
527 PortForwarding: nil,
528 AutoscalingConfig: nil,
529 },
530 {
531 Name: "5",
532 Image: "",
533 PortForwarding: nil,
534 AutoscalingConfig: nil,
535 },
536 }, nil
537 }).Times(1)
538
539 persistenceLayer.EXPECT().GetDataPlaneInformation(gomock.Any()).DoAndReturn(func(_ context.Context) ([]*proto.DataplaneInformation, error) {
540 return make([]*proto.DataplaneInformation, 0), nil
541 }).Times(1)
542
543 persistenceLayer.EXPECT().SetLeader(gomock.Any()).DoAndReturn(func(_ context.Context) error {
544 return nil
545 }).Times(1)
546
547 controlPlane := NewControlPlane(persistenceLayer, "", placement_policy.NewRandomPlacement(), data_plane.NewDataplaneConnection, workers.NewWorkerNode, &mockConfig)
548
549 start := time.Now()

Callers

nothing calls this directly

Calls 12

EXPECTMethod · 0.95
ReconstructStateMethod · 0.95
GetNumberDataplanesMethod · 0.95
GetNumberServicesMethod · 0.95
NewMockPersistenceLayerFunction · 0.92
NewRandomPlacementFunction · 0.92
NewControlPlaneFunction · 0.85
GetServiceInformationMethod · 0.65
SetLeaderMethod · 0.65

Tested by

no test coverage detected