Refactor E2E port registration (#10306)

* Refactor e2e port registration

* uncomment tests

* explain calculation

* fix things

* change param to pointer

* fix errors

* unit test and constant
This commit is contained in:
Radosław Kapka
2022-03-04 10:26:28 +01:00
committed by GitHub
parent 69618d157a
commit 54915850a2
15 changed files with 307 additions and 84 deletions

View File

@@ -201,12 +201,12 @@ func LogErrorOutput(t *testing.T, file io.Reader, title string, index int) {
// WritePprofFiles writes the memory heap and cpu profile files to the test path.
func WritePprofFiles(testDir string, index int) error {
url := fmt.Sprintf("http://127.0.0.1:%d/debug/pprof/heap", e2e.TestParams.BeaconNodeRPCPort+50+index)
url := fmt.Sprintf("http://127.0.0.1:%d/debug/pprof/heap", e2e.TestParams.Ports.PrysmBeaconNodePprofPort+index)
filePath := filepath.Join(testDir, fmt.Sprintf(memoryHeapFileName, index))
if err := writeURLRespAtPath(url, filePath); err != nil {
return err
}
url = fmt.Sprintf("http://127.0.0.1:%d/debug/pprof/profile", e2e.TestParams.BeaconNodeRPCPort+50+index)
url = fmt.Sprintf("http://127.0.0.1:%d/debug/pprof/profile", e2e.TestParams.Ports.PrysmBeaconNodePprofPort+index)
filePath = filepath.Join(testDir, fmt.Sprintf(cpuProfileFileName, index))
return writeURLRespAtPath(url, filePath)
}
@@ -255,7 +255,7 @@ func NewLocalConnection(ctx context.Context, port int) (*grpc.ClientConn, error)
func NewLocalConnections(ctx context.Context, numConns int) ([]*grpc.ClientConn, func(), error) {
conns := make([]*grpc.ClientConn, numConns)
for i := 0; i < len(conns); i++ {
conn, err := NewLocalConnection(ctx, e2e.TestParams.BeaconNodeRPCPort+i)
conn, err := NewLocalConnection(ctx, e2e.TestParams.Ports.PrysmBeaconNodeRPCPort+i)
if err != nil {
return nil, nil, err
}