github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/databases/dbconn_test.go (about) 1 // Copyright 2023 IAC. All Rights Reserved. 2 3 // 4 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 7 // you may not use this file except in compliance with the License. 8 9 // You may obtain a copy of the License at 10 11 // 12 13 // http://www.apache.org/licenses/LICENSE-2.0 14 15 // 16 17 // Unless required by applicable law or agreed to in writing, software 18 19 // distributed under the License is distributed on an "AS IS" BASIS, 20 21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 23 // See the License for the specific language governing permissions and 24 25 // limitations under the License. 26 27 package dbconn 28 29 import ( 30 "testing" 31 32 _ "github.com/denisenkom/go-mssqldb" 33 _ "github.com/go-sql-driver/mysql" 34 ) 35 36 func TestConnectDB(t *testing.T) { 37 tests := []struct { 38 name string 39 wantErr bool 40 }{ 41 // TODO: Add test cases. 42 } 43 for _, tt := range tests { 44 t.Run(tt.name, func(t *testing.T) { 45 if err := ConnectDB(); (err != nil) != tt.wantErr { 46 t.Errorf("ConnectDB() error = %v, wantErr %v", err, tt.wantErr) 47 } 48 }) 49 } 50 } 51 52 func TestDBPing(t *testing.T) { 53 tests := []struct { 54 name string 55 wantErr bool 56 }{ 57 // TODO: Add test cases. 58 } 59 for _, tt := range tests { 60 t.Run(tt.name, func(t *testing.T) { 61 if err := DBPing(); (err != nil) != tt.wantErr { 62 t.Errorf("DBPing() error = %v, wantErr %v", err, tt.wantErr) 63 } 64 }) 65 } 66 }