add more e2e test (#2505)

This commit is contained in:
fatedier
2021-08-02 13:07:28 +08:00
committed by GitHub
parent 2a68c1152f
commit 09f39de74e
20 changed files with 1448 additions and 154 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
"text/template"
@@ -256,3 +257,10 @@ func (f *Framework) RunServer(portName string, s server.Server) {
func (f *Framework) SetEnvs(envs []string) {
f.osEnvs = envs
}
func (f *Framework) WriteTempFile(name string, content string) string {
filePath := filepath.Join(f.TempDirectory, name)
err := ioutil.WriteFile(filePath, []byte(content), 0766)
ExpectNoError(err)
return filePath
}

View File

@@ -55,6 +55,11 @@ func NewRequestExpect(f *Framework) *RequestExpect {
}
}
func (e *RequestExpect) Request(req *request.Request) *RequestExpect {
e.req = req
return e
}
func (e *RequestExpect) RequestModify(f func(r *request.Request)) *RequestExpect {
f(e.req)
return e