From 61b60ead8577192cff9b2d36b63dd09e5b588b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E6=B6=A6=E6=A2=93?= <528185299@qq.com> Date: Fri, 28 Jun 2024 16:19:42 +0800 Subject: [PATCH] fix --- tests/e2e/greptimedbcluster_baremetal_test.go | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/tests/e2e/greptimedbcluster_baremetal_test.go b/tests/e2e/greptimedbcluster_baremetal_test.go index 05f5eab0..be1d04a6 100644 --- a/tests/e2e/greptimedbcluster_baremetal_test.go +++ b/tests/e2e/greptimedbcluster_baremetal_test.go @@ -17,8 +17,6 @@ package e2e import ( - "context" - "database/sql" "fmt" "io" "net" @@ -26,7 +24,6 @@ import ( "os/exec" "time" - "github.com/go-sql-driver/mysql" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -79,63 +76,6 @@ var _ = Describe("Basic test of greptimedb cluster in baremetal", func() { GinkgoWriter.Printf("failed to terminated the process\n") } - By("Connecting GreptimeDB") - var db *sql.DB - var conn *sql.Conn - - Eventually(func() error { - cfg := mysql.Config{ - Net: "tcp", - Addr: "127.0.0.1:4002", - User: "", - Passwd: "", - DBName: "", - AllowNativePasswords: true, - } - - db, err = sql.Open("mysql", cfg.FormatDSN()) - if err != nil { - return err - } - - conn, err = db.Conn(context.TODO()) - if err != nil { - return err - } - - return nil - }, 30*time.Second, time.Second).ShouldNot(HaveOccurred()) - - By("Execute SQL queries after connecting") - - ctx, cancel := context.WithTimeout(context.Background(), defaultQueryTimeout) - defer cancel() - - _, err = conn.ExecContext(ctx, createTableSQL) - Expect(err).NotTo(HaveOccurred(), "failed to create SQL table") - - ctx, cancel = context.WithTimeout(context.Background(), defaultQueryTimeout) - defer cancel() - for rowID := 1; rowID <= testRowIDNum; rowID++ { - insertDataSQL := fmt.Sprintf(insertDataSQLStr, rowID, rowID) - _, err = conn.ExecContext(ctx, insertDataSQL) - Expect(err).NotTo(HaveOccurred(), "failed to insert data") - } - - ctx, cancel = context.WithTimeout(context.Background(), defaultQueryTimeout) - defer cancel() - results, err := conn.QueryContext(ctx, selectDataSQL) - Expect(err).NotTo(HaveOccurred(), "failed to get data") - - var data []TestData - for results.Next() { - var d TestData - err = results.Scan(&d.timestamp, &d.n, &d.rowID) - Expect(err).NotTo(HaveOccurred(), "failed to scan data that query from db") - data = append(data, d) - } - Expect(len(data) == testRowIDNum).Should(BeTrue(), "get the wrong data from db") - err = deleteClusterinBaremetal() Expect(err).NotTo(HaveOccurred(), "failed to delete cluster in baremetal") })