Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions _example/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"net"
"testing"
"time"

_ "github.com/go-sql-driver/mysql"
"github.com/gocraft/dbr/v2"
Expand All @@ -40,6 +41,8 @@ func TestExampleUsersDisabled(t *testing.T) {
main()
}()

// Wait for the database to start
time.Sleep(1 * time.Second)
conn, err := dbr.Open("mysql", fmt.Sprintf("no_user:@tcp(%s:%d)/%s", address, port, dbName), nil)
require.NoError(t, err)
require.NoError(t, conn.Ping())
Expand All @@ -57,7 +60,6 @@ func TestExampleRootUserEnabled(t *testing.T) {
go func() {
main()
}()

conn, err := dbr.Open("mysql", fmt.Sprintf("no_user:@tcp(%s:%d)/%s", address, port, dbName), nil)
require.NoError(t, err)
require.ErrorContains(t, conn.Ping(), "User not found")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure we want to keep these around

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted it,pls check again

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been out of the office on leave, but this looks good.

Expand All @@ -78,7 +80,6 @@ func TestExampleLoadedUser(t *testing.T) {
go func() {
main()
}()

conn, err := dbr.Open("mysql", fmt.Sprintf("no_user:@tcp(%s:%d)/%s", address, port, dbName), nil)
require.NoError(t, err)
require.ErrorContains(t, conn.Ping(), "User not found")
Expand All @@ -103,7 +104,6 @@ func TestIssue1621(t *testing.T) {
go func() {
main()
}()

conn, err := dbr.Open("mysql",
fmt.Sprintf("root:@tcp(localhost:%d)/mydb", port), nil)
require.NoError(t, err)
Expand Down