github.com/aergoio/aergo@v1.3.1/polaris/server/healthcheck_test.go (about) 1 /* 2 * @file 3 * @copyright defined in aergo/LICENSE.txt 4 */ 5 6 package server 7 8 import ( 9 "reflect" 10 "testing" 11 12 "github.com/aergoio/aergo-lib/log" 13 "github.com/aergoio/aergo/p2p/p2pcommon" 14 ) 15 16 func TestNewHCM(t *testing.T) { 17 type args struct { 18 mapService *PeerMapService 19 nt p2pcommon.NetworkTransport 20 } 21 tests := []struct { 22 name string 23 args args 24 want *healthCheckManager 25 }{ 26 // TODO: Add test cases. 27 } 28 for _, tt := range tests { 29 t.Run(tt.name, func(t *testing.T) { 30 if got := NewHCM(tt.args.mapService, tt.args.nt); !reflect.DeepEqual(got, tt.want) { 31 t.Errorf("NewHCM() = %v, want %v", got, tt.want) 32 } 33 }) 34 } 35 } 36 37 func Test_healthCheckManager_Start(t *testing.T) { 38 type fields struct { 39 logger *log.Logger 40 ms *PeerMapService 41 nt p2pcommon.NetworkTransport 42 finish chan interface{} 43 workerCnt int 44 } 45 tests := []struct { 46 name string 47 fields fields 48 }{ 49 // TODO: Add test cases. 50 } 51 for _, tt := range tests { 52 t.Run(tt.name, func(t *testing.T) { 53 hcm := &healthCheckManager{ 54 logger: tt.fields.logger, 55 ms: tt.fields.ms, 56 nt: tt.fields.nt, 57 finish: tt.fields.finish, 58 workerCnt: tt.fields.workerCnt, 59 } 60 hcm.Start() 61 }) 62 } 63 } 64 65 func Test_healthCheckManager_Stop(t *testing.T) { 66 type fields struct { 67 logger *log.Logger 68 ms *PeerMapService 69 nt p2pcommon.NetworkTransport 70 finish chan interface{} 71 workerCnt int 72 } 73 tests := []struct { 74 name string 75 fields fields 76 }{ 77 // TODO: Add test cases. 78 } 79 for _, tt := range tests { 80 t.Run(tt.name, func(t *testing.T) { 81 hcm := &healthCheckManager{ 82 logger: tt.fields.logger, 83 ms: tt.fields.ms, 84 nt: tt.fields.nt, 85 finish: tt.fields.finish, 86 workerCnt: tt.fields.workerCnt, 87 } 88 hcm.Stop() 89 }) 90 } 91 } 92 93 func Test_healthCheckManager_runHCM(t *testing.T) { 94 type fields struct { 95 logger *log.Logger 96 ms *PeerMapService 97 nt p2pcommon.NetworkTransport 98 finish chan interface{} 99 workerCnt int 100 } 101 tests := []struct { 102 name string 103 fields fields 104 }{ 105 // TODO: Add test cases. 106 } 107 for _, tt := range tests { 108 t.Run(tt.name, func(t *testing.T) { 109 hcm := &healthCheckManager{ 110 logger: tt.fields.logger, 111 ms: tt.fields.ms, 112 nt: tt.fields.nt, 113 finish: tt.fields.finish, 114 workerCnt: tt.fields.workerCnt, 115 } 116 hcm.runHCM() 117 }) 118 } 119 } 120 121 func Test_healthCheckManager_checkPeers(t *testing.T) { 122 type fields struct { 123 logger *log.Logger 124 ms *PeerMapService 125 nt p2pcommon.NetworkTransport 126 finish chan interface{} 127 workerCnt int 128 } 129 tests := []struct { 130 name string 131 fields fields 132 }{ 133 // TODO: Add test cases. 134 } 135 for _, tt := range tests { 136 t.Run(tt.name, func(t *testing.T) { 137 hcm := &healthCheckManager{ 138 logger: tt.fields.logger, 139 ms: tt.fields.ms, 140 nt: tt.fields.nt, 141 finish: tt.fields.finish, 142 workerCnt: tt.fields.workerCnt, 143 } 144 hcm.checkPeers() 145 }) 146 } 147 }