bt-fixture is a test-fixture management library for the Cloud Bigtable.
Management the fixtures of the database for testing.
- Load the Cloud Bigtable columns fixture by a yaml file
- Before cleanup a table
- Types
- int and float types in a fixture convert to big-endian 8-byte values
- Import
bt-fixture
package and setup a fixture file
package main
import (
fixture "github.com/takashabe/bt-fixture"
)
func main() {
// omit the error handling
f, _ := fixture.New("test-project", "test-instance")
f.Load("testdata/fixture.yaml")
}
table: person
column_families:
- family: d
columns:
- key: 1##a
rows:
name: a
age: 10
height: 140.0
version: 2018-05-19 00:00:00 +00:00
- key: 1##a
rows:
name: a
abe: 11
height: 140.0
version: 2019-05-19 00:00:00 +00:00
- family: e
columns:
- key: 2##b
rows:
name: b
age: 20
height: 180.0
version: 2018-05-19 00:00:00 +00:00
- Example output:
$cbt read person
----------------------------------------
1##a
d:age @ 2019/05/19-00:00:00.000000
"\x00\x00\x00\x00\x00\x00\x00\v"
d:age @ 2018/05/19-00:00:00.000000
"\x00\x00\x00\x00\x00\x00\x00\n"
d:height @ 2019/05/19-00:00:00.000000
"@a\x80\x00\x00\x00\x00\x00"
d:height @ 2018/05/19-00:00:00.000000
"@a\x80\x00\x00\x00\x00\x00"
d:name @ 2019/05/19-00:00:00.000000
"a"
d:name @ 2018/05/19-00:00:00.000000
"a"
----------------------------------------
2##b
e:age @ 2018/05/19-00:00:00.000000
"\x00\x00\x00\x00\x00\x00\x00\x14"
e:height @ 2018/05/19-00:00:00.000000
"@f\x80\x00\x00\x00\x00\x00"
e:name @ 2018/05/19-00:00:00.000000
"b"