storage/sql: print error before calling t.Fatal
This commit is contained in:
		| @@ -72,15 +72,20 @@ func TestPostgres(t *testing.T) { | |||||||
| 		}, | 		}, | ||||||
| 		ConnectionTimeout: 5, | 		ConnectionTimeout: 5, | ||||||
| 	} | 	} | ||||||
| 	conn, err := p.open() |  | ||||||
| 	if err != nil { | 	// t.Fatal has a bad habbit of not actually printing the error | ||||||
| 		t.Fatal(err) | 	fatal := func(i interface{}) { | ||||||
|  | 		fmt.Fprintln(os.Stdout, i) | ||||||
|  | 		t.Fatal(i) | ||||||
| 	} | 	} | ||||||
| 	defer conn.Close() |  | ||||||
|  |  | ||||||
| 	newStorage := func() storage.Storage { | 	newStorage := func() storage.Storage { | ||||||
|  | 		conn, err := p.open() | ||||||
|  | 		if err != nil { | ||||||
|  | 			fatal(err) | ||||||
|  | 		} | ||||||
| 		if err := cleanDB(conn); err != nil { | 		if err := cleanDB(conn); err != nil { | ||||||
| 			t.Fatal(err) | 			fatal(err) | ||||||
| 		} | 		} | ||||||
| 		return conn | 		return conn | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user