Delete unnecessary test cases.

pull/345/head
Otokaze 5 years ago
parent 0cf5148dfe
commit 642aa3dea5
  1. 1
      go.mod
  2. 9
      go.sum
  3. 8
      pkg/testing/lich/composer.go
  4. 23
      pkg/testing/lich/composer_test.go
  5. 4
      tool/testcli/README.MD

@ -35,7 +35,6 @@ require (
github.com/shirou/gopsutil v2.19.6+incompatible
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726
github.com/sirupsen/logrus v1.4.2
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
github.com/stretchr/testify v1.3.0
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
github.com/tsuna/gohbase v0.0.0-20190502052937-24ffed0537aa

@ -95,8 +95,6 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
@ -121,8 +119,6 @@ github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwK
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
@ -217,10 +213,6 @@ github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjM
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
@ -315,7 +307,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b h1:mSUCVIwDx4hfXJfWsOPfdzEHxzb2Xjl6BQ8YgPnazQA=

@ -37,7 +37,7 @@ func Setup() (err error) {
pathHash = fmt.Sprintf("%x", md5.Sum([]byte(yamlPath)))[:9]
var args = []string{"-f", yamlPath, "-p", pathHash, "up", "-d"}
if err = exec.Command("docker-compose", args...).Run(); err != nil {
log.Printf("exec.Command(docker-composer) args(%v) error(%v)", args, err)
log.Printf("exec.Command(docker-compose) args(%v) error(%v)", args, err)
Teardown()
return
}
@ -67,7 +67,7 @@ func Teardown() (err error) {
pathHash = fmt.Sprintf("%x", md5.Sum([]byte(yamlPath)))[:9]
args := []string{"-f", yamlPath, "-p", pathHash, "down"}
if output, err := exec.Command("docker-compose", args...).CombinedOutput(); err != nil {
log.Fatalf("exec.Command(docker-composer) args(%v) stdout(%s) error(%v)", args, string(output), err)
log.Fatalf("exec.Command(docker-compose) args(%v) stdout(%s) error(%v)", args, string(output), err)
return err
}
return
@ -76,7 +76,7 @@ func Teardown() (err error) {
func getServices() (output []byte, err error) {
var args = []string{"-f", yamlPath, "-p", pathHash, "config", "--services"}
if output, err = exec.Command("docker-compose", args...).CombinedOutput(); err != nil {
log.Printf("exec.Command(docker-composer) args(%v) stdout(%s) error(%v)", args, string(output), err)
log.Printf("exec.Command(docker-compose) args(%v) stdout(%s) error(%v)", args, string(output), err)
return
}
services = make(map[string]*Container)
@ -84,7 +84,7 @@ func getServices() (output []byte, err error) {
for _, svr := range bytes.Split(output, []byte("\n")) {
args = []string{"-f", yamlPath, "-p", pathHash, "ps", "-a", "-q", string(svr)}
if output, err = exec.Command("docker-compose", args...).CombinedOutput(); err != nil {
log.Printf("exec.Command(docker-composer) args(%v) stdout(%s) error(%v)", args, string(output), err)
log.Printf("exec.Command(docker-compose) args(%v) stdout(%s) error(%v)", args, string(output), err)
return
}
var id = string(bytes.TrimSpace(output))

@ -1,23 +0,0 @@
package lich
import (
"testing"
"github.com/smartystreets/goconvey/convey"
)
func TestComposer(t *testing.T) {
convey.Convey("Composer testing....", t, func(convCtx convey.C) {
convCtx.Convey("When Setup everything goes positive", func(convCtx convey.C) {
convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
convCtx.So(Setup(), convey.ShouldBeNil)
})
})
convCtx.Convey("When UnSetup everything goes positive", func(convCtx convey.C) {
convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
convCtx.So(Teardown(), convey.ShouldBeNil)
})
})
})
}

@ -10,7 +10,7 @@
- 提供一站式解决 UT 服务依赖的工具版本 (testcli)
### 编译安装
*使用本工具/库需要前置安装好 docker&docker-compose*
*使用本工具/库需要前置安装好 docker & docker-compose@v1.24.1^*
#### Method 1. With go get
```shell
@ -87,7 +87,7 @@ CREATE TABLE IF NOT EXISTS `YOUR_TABLE_NAME` (
execTimeout = "1s"
tranTimeout = "1s"
```
在 *Step 1* 我们以及指定了服务对外暴露的端口为3306(这当然也可以是你指定的任何值),那理所应当的我们也要修改项目连接数据库的配置~
在 *Step 1* 我们已经指定了服务对外暴露的端口为3306(这当然也可以是你指定的任何值),那理所应当的我们也要修改项目连接数据库的配置~
Great! 至此你已经完成了运行所需要用到的数据配置,接下来就来运行它。

Loading…
Cancel
Save