add e2e tests for v1 config (#3608)

This commit is contained in:
fatedier
2023-09-13 16:32:39 +08:00
committed by GitHub
parent c95311d1a0
commit 7cd02f5bd8
61 changed files with 3697 additions and 159 deletions

View File

@@ -18,12 +18,23 @@ var (
PortClientAdmin string
DefaultServerConfig = `
bindPort = {{ .%s }}
log.level = "trace"
`
DefaultClientConfig = `
serverAddr = "127.0.0.1"
serverPort = {{ .%s }}
log.level = "trace"
`
LegacyDefaultServerConfig = `
[common]
bind_port = {{ .%s }}
log_level = trace
`
DefaultClientConfig = `
LegacyDefaultClientConfig = `
[common]
server_addr = 127.0.0.1
server_port = {{ .%s }}
@@ -34,6 +45,9 @@ var (
func init() {
PortServerName = port.GenName("Server")
PortClientAdmin = port.GenName("ClientAdmin")
LegacyDefaultServerConfig = fmt.Sprintf(LegacyDefaultServerConfig, port.GenName("Server"))
LegacyDefaultClientConfig = fmt.Sprintf(LegacyDefaultClientConfig, port.GenName("Server"))
DefaultServerConfig = fmt.Sprintf(DefaultServerConfig, port.GenName("Server"))
DefaultClientConfig = fmt.Sprintf(DefaultClientConfig, port.GenName("Server"))
}

View File

@@ -29,7 +29,10 @@ func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []str
path := filepath.Join(f.TempDirectory, fmt.Sprintf("frp-e2e-server-%d", i))
err = os.WriteFile(path, []byte(outs[i]), 0o666)
ExpectNoError(err)
flog.Trace("[%s] %s", path, outs[i])
if TestContext.Debug {
flog.Debug("[%s] %s", path, outs[i])
}
p := process.NewWithEnvs(TestContext.FRPServerPath, []string{"-c", path}, f.osEnvs)
f.serverConfPaths = append(f.serverConfPaths, path)
@@ -46,7 +49,10 @@ func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []str
path := filepath.Join(f.TempDirectory, fmt.Sprintf("frp-e2e-client-%d", i))
err = os.WriteFile(path, []byte(outs[index]), 0o666)
ExpectNoError(err)
flog.Trace("[%s] %s", path, outs[index])
if TestContext.Debug {
flog.Debug("[%s] %s", path, outs[index])
}
p := process.NewWithEnvs(TestContext.FRPClientPath, []string{"-c", path}, f.osEnvs)
f.clientConfPaths = append(f.clientConfPaths, path)