diff --git a/.github/ISSUE_TEMPLATE/bug------bug-report.md b/.github/ISSUE_TEMPLATE/bug------bug-report.md new file mode 100644 index 0000000..a56c972 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug------bug-report.md @@ -0,0 +1,21 @@ +--- +name: Bug 报告 | Bug report +about: Create a report to help us improve +title: "【Bug】" +labels: bug +assignees: '' + +--- + +**在提出此issue时,我确认了以下几点(保存后请点击复选框):** + +- [ ] 我已自己确认这是Sonic自身的Bug。 +- [ ] 我接受此issue可能被关闭,并查看开发人员的建议。 + +**Bug 描述** +清晰地描述Bug的情况与详细复现步骤 | A clear and concise description of what the bug is. + +**版本** +Sonic的版本号 | Sonic's Version. +部署的系统(mac,windows32...) | System + diff --git a/.github/pull-request-template.md b/.github/pull-request-template.md new file mode 100644 index 0000000..1f9768b --- /dev/null +++ b/.github/pull-request-template.md @@ -0,0 +1,9 @@ +**在提出此拉取请求时,我确认了以下几点(保存后请点击复选框):** + +- [ ] 我已检查没有与此请求重复的拉取请求。 +- [ ] 我已经考虑过,并确认这份呈件对其他人很有价值。 +- [ ] 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。 + +**填写PR内容:** + +- diff --git a/cmd/run/wda.go b/cmd/run/wda.go index c097eeb..43c5fe0 100644 --- a/cmd/run/wda.go +++ b/cmd/run/wda.go @@ -24,6 +24,7 @@ import ( "github.com/mitchellh/mapstructure" "github.com/spf13/cobra" "io" + "io/ioutil" "log" "net" "net/http" @@ -118,20 +119,24 @@ var wdaCmd = &cobra.Command{ go func() { var resp *http.Response var httpErr error - var checkTime = 0 ticker := time.NewTicker(time.Second * 10) + c := &http.Client{ + Timeout: 2 * time.Second, + } for { select { case <-ticker.C: - resp, httpErr = http.Get(fmt.Sprintf("http://127.0.0.1:%d/health", serverLocalPort)) + resp, httpErr = c.Get(fmt.Sprintf("http://127.0.0.1:%d/health", serverLocalPort)) + var re string if httpErr != nil { - fmt.Printf("request fail: %s", httpErr) - continue - } - if resp.StatusCode == 200 { - fmt.Printf("wda server health checked %d times: ok\n", checkTime) + fmt.Println("WebDriverAgent server health timeout.") } else { - stopTest() + defer resp.Body.Close() + body, _ := ioutil.ReadAll(resp.Body) + re = string(body) + } + if httpErr != nil || re != "I-AM-ALIVE" { + fmt.Println("WebDriverAgent server unhealthy.") var upTimes = 0 for { output, stopTest, err2 = device.XCTest(wdaBundleID, giDevice.WithXCTestEnv(testEnv)) @@ -189,7 +194,6 @@ func proxy() func(listener net.Listener, port int, device giDevice.Device) { if accept, err = listener.Accept(); err != nil { log.Println("accept:", err) } - fmt.Println("accept", accept.RemoteAddr()) rInnerConn, err := device.NewConnect(port) if err != nil { fmt.Println("connect to device fail")