aboutsummaryrefslogtreecommitdiff
path: root/vendor/mysql/connector_test.go
diff options
context:
space:
mode:
authorSina Ghaderi <32870524+Sina-Ghaderi@users.noreply.github.com>2021-03-19 08:06:20 +0330
committerGitHub <noreply@github.com>2021-03-19 08:06:20 +0330
commitb8bb371ca118aa63785adffd98bb24cc1113f1c5 (patch)
tree00bab7b7194f92bee0e831958e34c099efbf80ff /vendor/mysql/connector_test.go
parente16ec4f65419aefa0bb401d6af2e30be0d6bfa25 (diff)
pushing to git services
Diffstat (limited to 'vendor/mysql/connector_test.go')
-rw-r--r--vendor/mysql/connector_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/mysql/connector_test.go b/vendor/mysql/connector_test.go
new file mode 100644
index 0000000..976903c
--- /dev/null
+++ b/vendor/mysql/connector_test.go
@@ -0,0 +1,30 @@
+package mysql
+
+import (
+ "context"
+ "net"
+ "testing"
+ "time"
+)
+
+func TestConnectorReturnsTimeout(t *testing.T) {
+ connector := &connector{&Config{
+ Net: "tcp",
+ Addr: "1.1.1.1:1234",
+ Timeout: 10 * time.Millisecond,
+ }}
+
+ _, err := connector.Connect(context.Background())
+ if err == nil {
+ t.Fatal("error expected")
+ }
+
+ if nerr, ok := err.(*net.OpError); ok {
+ expected := "dial tcp 1.1.1.1:1234: i/o timeout"
+ if nerr.Error() != expected {
+ t.Fatalf("expected %q, got %q", expected, nerr.Error())
+ }
+ } else {
+ t.Fatalf("expected %T, got %T", nerr, err)
+ }
+}

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR