|
@@ -12,7 +12,7 @@ import (
|
|
|
|
|
|
// RunProcesses run multiple processes from templates.
|
|
// RunProcesses run multiple processes from templates.
|
|
// The first template should always be frps.
|
|
// The first template should always be frps.
|
|
-func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []string) {
|
|
|
|
|
|
+func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []string) ([]*process.Process, []*process.Process) {
|
|
templates := make([]string, 0, len(serverTemplates)+len(clientTemplates))
|
|
templates := make([]string, 0, len(serverTemplates)+len(clientTemplates))
|
|
for _, t := range serverTemplates {
|
|
for _, t := range serverTemplates {
|
|
templates = append(templates, t)
|
|
templates = append(templates, t)
|
|
@@ -28,6 +28,7 @@ func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []str
|
|
f.usedPorts[name] = port
|
|
f.usedPorts[name] = port
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ currentServerProcesses := make([]*process.Process, 0, len(serverTemplates))
|
|
for i := range serverTemplates {
|
|
for i := range serverTemplates {
|
|
path := filepath.Join(f.TempDirectory, fmt.Sprintf("frp-e2e-server-%d", i))
|
|
path := filepath.Join(f.TempDirectory, fmt.Sprintf("frp-e2e-server-%d", i))
|
|
err = os.WriteFile(path, []byte(outs[i]), 0666)
|
|
err = os.WriteFile(path, []byte(outs[i]), 0666)
|
|
@@ -37,11 +38,13 @@ func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []str
|
|
p := process.NewWithEnvs(TestContext.FRPServerPath, []string{"-c", path}, f.osEnvs)
|
|
p := process.NewWithEnvs(TestContext.FRPServerPath, []string{"-c", path}, f.osEnvs)
|
|
f.serverConfPaths = append(f.serverConfPaths, path)
|
|
f.serverConfPaths = append(f.serverConfPaths, path)
|
|
f.serverProcesses = append(f.serverProcesses, p)
|
|
f.serverProcesses = append(f.serverProcesses, p)
|
|
|
|
+ currentServerProcesses = append(currentServerProcesses, p)
|
|
err = p.Start()
|
|
err = p.Start()
|
|
ExpectNoError(err)
|
|
ExpectNoError(err)
|
|
}
|
|
}
|
|
time.Sleep(time.Second)
|
|
time.Sleep(time.Second)
|
|
|
|
|
|
|
|
+ currentClientProcesses := make([]*process.Process, 0, len(clientTemplates))
|
|
for i := range clientTemplates {
|
|
for i := range clientTemplates {
|
|
index := i + len(serverTemplates)
|
|
index := i + len(serverTemplates)
|
|
path := filepath.Join(f.TempDirectory, fmt.Sprintf("frp-e2e-client-%d", i))
|
|
path := filepath.Join(f.TempDirectory, fmt.Sprintf("frp-e2e-client-%d", i))
|
|
@@ -52,11 +55,14 @@ func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []str
|
|
p := process.NewWithEnvs(TestContext.FRPClientPath, []string{"-c", path}, f.osEnvs)
|
|
p := process.NewWithEnvs(TestContext.FRPClientPath, []string{"-c", path}, f.osEnvs)
|
|
f.clientConfPaths = append(f.clientConfPaths, path)
|
|
f.clientConfPaths = append(f.clientConfPaths, path)
|
|
f.clientProcesses = append(f.clientProcesses, p)
|
|
f.clientProcesses = append(f.clientProcesses, p)
|
|
|
|
+ currentClientProcesses = append(currentClientProcesses, p)
|
|
err = p.Start()
|
|
err = p.Start()
|
|
ExpectNoError(err)
|
|
ExpectNoError(err)
|
|
time.Sleep(500 * time.Millisecond)
|
|
time.Sleep(500 * time.Millisecond)
|
|
}
|
|
}
|
|
time.Sleep(500 * time.Millisecond)
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
+
|
|
|
|
+ return currentServerProcesses, currentClientProcesses
|
|
}
|
|
}
|
|
|
|
|
|
func (f *Framework) RunFrps(args ...string) (*process.Process, string, error) {
|
|
func (f *Framework) RunFrps(args ...string) (*process.Process, string, error) {
|