func BucketId(bucketId typing.BucketId) btesting.Writer { return func(config *btesting.Configuration) interface{} { if config.Bool("BucketIdBinary") { return []byte(bucketId) } else { return bucketId.ToBase32String() } } }
// 1. Creates a bucket (storage) // 2. Sees what metadata can be found for hat bucket. func testScanMetadata(t btesting.T) { // The haser bucket is the simplest one, it currently only has one single metadata: // 'const.system.type_id' // First create a bucket var bucketId typing.BucketId operations.CreateBucket(t, typing.TypeId_Store, &bucketId) if t.Failed() { return } var keyAsBinary []byte t.Request(btesting.Request{ Input: btesting.Object{ "Operation": "Scan", "Data": btesting.Object{ "BucketId": fmt.Sprintf(":meta-id:%v", bucketId.ToBase32String()), "FromKey": "", "Limit": 1, }, }, Expecting: btesting.Object{ "Code": eval.RetcodeOk(), "Data": btesting.Object{ "HasMore": false, "Results": btesting.Array{ btesting.Object{ "Key": btesting.Array{eval.IsAnyBinaryB32(&keyAsBinary)}, }, }, }, }, }) if t.Failed() { return } keyAsString := string(keyAsBinary) if keyAsString != "const.system.type_id" { t.Errorf("Expecting to have the metadata const.system.type_id but have %v", keyAsString) return } }