Skip to content

Commit

Permalink
getting topn tests working #43
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-at-startupmedia committed Oct 14, 2024
1 parent 214a062 commit 850221e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/e2e/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (suite *Pmon3CoreTestSuite) TestF1_InitAll() {
func onKeyboardEventSort() chan controller.KeyboardResult {
ch := make(chan controller.KeyboardResult)
go func() {
time.Sleep(time.Second * 2)
ch <- controller.KeyboardResult{
Char: 's',
}
Expand All @@ -127,6 +128,7 @@ func onKeyboardEventSort() chan controller.KeyboardResult {
func onKeyboardEventEscape() chan controller.KeyboardResult {
ch := make(chan controller.KeyboardResult)
go func() {
time.Sleep(time.Second * 2)
ch <- controller.KeyboardResult{
Key: keyboard.KeyEsc,
}
Expand All @@ -137,6 +139,7 @@ func onKeyboardEventEscape() chan controller.KeyboardResult {
func onKeyboardEventError() chan controller.KeyboardResult {
ch := make(chan controller.KeyboardResult)
go func() {
time.Sleep(time.Second * 2)
ch <- controller.KeyboardResult{
Err: fmt.Errorf("simulating an error for testing"),
}
Expand All @@ -162,7 +165,7 @@ func (suite *Pmon3CoreTestSuite) TestF2_Top() {
var wg3 sync.WaitGroup
wg3.Add(1)
go controller.Topn(2, context.Background(), &wg3, onKeyboardEventError, os.Stdout)
suite.cliHelper.SleepFor(time.Millisecond * 4000)
suite.cliHelper.SleepFor(time.Millisecond * 8000)

cmdResp := suite.cliHelper.ExecBase0("top")
pidCsv := cmdResp.GetValueStr()
Expand Down

0 comments on commit 850221e

Please sign in to comment.