-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathglobal_migrate_integration_test.go
More file actions
52 lines (46 loc) · 999 Bytes
/
Copy pathglobal_migrate_integration_test.go
File metadata and controls
52 lines (46 loc) · 999 Bytes
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
48
49
50
51
52
//go:build integration
package migrate
import (
"context"
"testing"
)
func TestGlobalMigrateUp(t *testing.T) {
defer cleanup(db)
SetDatabase(db)
ctx := context.Background()
if err := Up(ctx, -1); err != nil {
t.Errorf("Unexpected error: %v", err)
return
}
version, description, err := Version(ctx)
if err != nil {
t.Errorf("Unexpected error: %v", err)
return
}
if version != 2 || description != "sample_index_test" {
t.Errorf("Unexpected version/description: %v %v", version, description)
return
}
}
func TestGlobalMigrateDown(t *testing.T) {
defer cleanup(db)
SetDatabase(db)
ctx := context.Background()
if err := Up(ctx, -1); err != nil {
t.Errorf("Unexpected error: %v", err)
return
}
if err := Down(ctx, -1); err != nil {
t.Errorf("Unexpected error: %v", err)
return
}
version, _, err := Version(ctx)
if err != nil {
t.Errorf("Unexpected error: %v", err)
return
}
if version != 0 {
t.Errorf("Unexpected version: %v", version)
return
}
}