forked from groupme/dynamodbtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_test.go
47 lines (39 loc) · 827 Bytes
/
db_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package dynamodbtest
import (
"fmt"
"testing"
"time"
)
// TestAll tests public API
func TestAll(t *testing.T) {
// Log output to aid debugging
LogOutput = true
// Increase connection timeout for Travis CI
ConnectTimeout = 25 * time.Second
// Start a new test process
db, err := New()
if err != nil {
t.Fatal(err)
}
url := db.URL()
if url != "http://localhost:8000" {
t.Error("URL is not correct")
}
_err := db.Close()
if _err != nil {
t.Fatal(_err)
}
}
func Example() {
// Log output to aid debugging
LogOutput = true
// Start a new test process
db, err := New()
if err != nil {
fmt.Errorf("Couldn't start DynamoDB local, %v", err)
}
defer db.Close()
// Choice of client is up to you, but you will need to point it at db.URL
//client := NewDynamoClient(...)
//client.URL = db.URL()
}