Skip to content

Commit 0cd3aa6

Browse files
committed
Add 3 seconds sleep after successful user deletion to ensure removal in database
1 parent f7b648f commit 0cd3aa6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/new_user_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package cmd
2222

2323
import (
2424
"testing"
25+
"time"
2526
)
2627

2728
func TestNewUser(t *testing.T) {
@@ -65,6 +66,9 @@ func TestNewUser(t *testing.T) {
6566
if tc.expect == pass {
6667
if err := deleteUser(tc.args[0]); err != nil {
6768
tInfo(err)
69+
} else {
70+
// sleep for at least 3 seconds to ensure that user is deleted
71+
time.Sleep(3 * time.Second)
6872
}
6973
}
7074

@@ -78,7 +82,7 @@ func TestNewUser(t *testing.T) {
7882
stdout, execResult := execT.executeCommand()
7983
assertEqualResult(t, execResult, tc.expect, printFlagsTable(tc.flagsMap, stdout))
8084
if tc.expect == pass {
81-
assertStringContains(t, stdout, tc.args[0])
85+
assertOutContains(t, stdout, tc.args[0])
8286
}
8387
})
8488
}

0 commit comments

Comments
 (0)