| 1 | package statement |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/influxdata/influxdb/stress/v2/stress_client" |
| 8 | ) |
| 9 | |
| 10 | func TestWaitSetID(t *testing.T) { |
| 11 | e := newTestWait() |
| 12 | newID := "oaijnifo" |
| 13 | e.SetID(newID) |
| 14 | if e.StatementID != newID { |
| 15 | t.Errorf("Expected: %v\ngott: %v\n", newID, e.StatementID) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | func TestWaitRun(t *testing.T) { |
| 20 | e := newTestWait() |
| 21 | s, _, _ := stressClient.NewTestStressTest() |
| 22 | e.Run(s) |
| 23 | if e == nil { |
| 24 | t.Fail() |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | func TestWaitReport(t *testing.T) { |
| 29 | e := newTestWait() |
| 30 | s, _, _ := stressClient.NewTestStressTest() |
| 31 | rpt := e.Report(s) |
| 32 | if !strings.Contains(rpt, "WAIT") { |
| 33 | t.Fail() |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | func newTestWait() *WaitStatement { |
| 38 | return &WaitStatement{ |
| 39 | StatementID: "fooID", |
| 40 | } |
| 41 | } |