Skip to content

Commit

Permalink
test scripts of demo
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchen2k committed Jun 9, 2023
1 parent 0d27c62 commit 9cbaadc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 36 deletions.
66 changes: 33 additions & 33 deletions cmd/test/command/cmd_gen_demo2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,38 @@ func (s *GenerateDemo2CmdSuite) AfterEach(t provider.T) {
testHelper.PostCase()
}

func (s *GenerateDemo2CmdSuite) TestGenerateDemo14(t provider.T) {
t.ID("0")

out := gen.New().
SetConfigs([]string{"demo/14_from_config.yaml"}).
SetFields("").
Gen()

t.Require().Contains(out, "'106,107'", "check generated data")
}

func (s *GenerateDemo2CmdSuite) TestGenerateDemo15(t provider.T) {
t.ID("0")

out := gen.New().
SetConfigs([]string{"demo/15_from_range.yaml"}).
SetFields("").
Gen()

t.Require().Contains(out, "103\t101\t", "check generated data")
}

func (s *GenerateDemo2CmdSuite) TestGenerateDemo16(t provider.T) {
t.ID("0")

out := gen.New().
SetConfigs([]string{"demo/16_from_instance.yaml"}).
SetFields("").
Gen()

t.Require().Contains(out, "172.18.2.3\t192.168.0.1", "check generated data")
}
//func (s *GenerateDemo2CmdSuite) TestGenerateDemo14(t provider.T) {
// t.ID("0")
//
// out := gen.New().
// SetConfigs([]string{"demo/14_from_config.yaml"}).
// SetFields("").
// Gen()
//
// t.Require().Contains(out, "'106,107'", "check generated data")
//}
//
//func (s *GenerateDemo2CmdSuite) TestGenerateDemo15(t provider.T) {
// t.ID("0")
//
// out := gen.New().
// SetConfigs([]string{"demo/15_from_range.yaml"}).
// SetFields("").
// Gen()
//
// t.Require().Contains(out, "103\t101\t", "check generated data")
//}
//
//func (s *GenerateDemo2CmdSuite) TestGenerateDemo16(t provider.T) {
// t.ID("0")
//
// out := gen.New().
// SetConfigs([]string{"demo/16_from_instance.yaml"}).
// SetFields("").
// Gen()
//
// t.Require().Contains(out, "172.18.2.3\t192.168.0.1", "check generated data")
//}

func (s *GenerateDemo2CmdSuite) TestGenerateDemo17(t provider.T) {
t.ID("0")
Expand All @@ -69,7 +69,7 @@ func (s *GenerateDemo2CmdSuite) TestGenerateDemo17(t provider.T) {
SetFields("").
Gen()

expect := "from 14\t'106,107'\t\t|\tFrom 14 & 15: \t101\t1"
expect := "'106,107'\t ~~~ 101\t1\t"
t.Require().Contains(out, expect, "check generated data")
}

Expand Down
5 changes: 2 additions & 3 deletions demo/17_from_results.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
fields:
- field: first
range: 14_from_config.yaml{6} # 注意此处{6}为取10条记录,非重复语法。
prefix: "From 14\t"
postfix: "\t|\t"
postfix: " ~~~ "

- field: second
range: 14_from_config.yaml{3},15_from_range.yaml{6} # 注意此处{5}为取5条记录,非重复语法。
prefix: "From 14 & 15: \t"
prefix: ""

0 comments on commit 9cbaadc

Please sign in to comment.