本文整理汇总了Golang中github.com/janelia-flyem/dvid/tests.UseStore函数的典型用法代码示例。如果您正苦于以下问题:Golang UseStore函数的具体用法?Golang UseStore怎么用?Golang UseStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UseStore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestNewKeyvalueDifferent
// Make sure new keyvalue data have different IDs.
func TestNewKeyvalueDifferent(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, _ := initTestRepo()
// Add data
config := dvid.NewConfig()
dataservice1, err := datastore.NewData(uuid, kvtype, "instance1", config)
if err != nil {
t.Errorf("Error creating new keyvalue instance: %v\n", err)
}
kv1, ok := dataservice1.(*Data)
if !ok {
t.Errorf("Returned new data instance 1 is not keyvalue.Data\n")
}
if kv1.DataName() != "instance1" {
t.Errorf("New keyvalue data instance name set incorrectly: %q != %q\n",
kv1.DataName(), "instance1")
}
dataservice2, err := datastore.NewData(uuid, kvtype, "instance2", config)
if err != nil {
t.Errorf("Error creating new keyvalue instance: %v\n", err)
}
kv2, ok := dataservice2.(*Data)
if !ok {
t.Errorf("Returned new data instance 2 is not keyvalue.Data\n")
}
if kv1.InstanceID() == kv2.InstanceID() {
t.Errorf("Instance IDs should be different: %d == %d\n",
kv1.InstanceID(), kv2.InstanceID())
}
}
示例2: TestLabelblkDirectAPI
func TestLabelblkDirectAPI(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, versionID := initTestRepo()
labels := newDataInstance(uuid, t, "mylabels")
labelsCtx := datastore.NewVersionedCtx(labels, versionID)
// Create a fake block-aligned label volume
offset := dvid.Point3d{32, 0, 64}
size := dvid.Point3d{96, 64, 160}
subvol := dvid.NewSubvolume(offset, size)
data := makeVolume(offset, size)
// Store it into datastore at root
v, err := labels.NewVoxels(subvol, data)
if err != nil {
t.Fatalf("Unable to make new labels Voxels: %v\n", err)
}
if err = labels.PutVoxels(versionID, v, nil); err != nil {
t.Errorf("Unable to put labels for %s: %v\n", labelsCtx, err)
}
if v.NumVoxels() != int64(len(data))/8 {
t.Errorf("# voxels (%d) after PutVoxels != # original voxels (%d)\n",
v.NumVoxels(), int64(len(data))/8)
}
// Read the stored image
v2, err := labels.NewVoxels(subvol, nil)
if err != nil {
t.Errorf("Unable to make new labels ExtHandler: %v\n", err)
}
if err = labels.GetVoxels(versionID, v2, nil); err != nil {
t.Errorf("Unable to get voxels for %s: %v\n", labelsCtx, err)
}
// Make sure the retrieved image matches the original
if v.Stride() != v2.Stride() {
t.Errorf("Stride in retrieved subvol incorrect\n")
}
if v.Interpolable() != v2.Interpolable() {
t.Errorf("Interpolable bool in retrieved subvol incorrect\n")
}
if !reflect.DeepEqual(v.Size(), v2.Size()) {
t.Errorf("Size in retrieved subvol incorrect: %s vs expected %s\n",
v2.Size(), v.Size())
}
if v.NumVoxels() != v2.NumVoxels() {
t.Errorf("# voxels in retrieved is different: %d vs expected %d\n",
v2.NumVoxels(), v.NumVoxels())
}
byteData := v2.Data()
for i := int64(0); i < v2.NumVoxels()*8; i++ {
if byteData[i] != data[i] {
t.Logf("Size of data: %d bytes from GET, %d bytes in PUT\n", len(data), len(data))
t.Fatalf("GET subvol (%d) != PUT subvol (%d) @ uint64 #%d", byteData[i], data[i], i)
}
}
}
示例3: TestROICreateAndSerialize
func TestROICreateAndSerialize(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, _ := initTestRepo()
// Add data
config := dvid.NewConfig()
dataservice1, err := datastore.NewData(uuid, roitype, "myroi", config)
if err != nil {
t.Errorf("Error creating new roi instance: %v\n", err)
}
roi1, ok := dataservice1.(*Data)
if !ok {
t.Errorf("Returned new data instance 1 is not roi.Data\n")
}
if roi1.DataName() != "myroi" {
t.Errorf("New roi data instance name set incorrectly: %q != %q\n",
roi1.DataName(), "myroi")
}
config.Set("BlockSize", "15,16,17")
dataservice2, err := datastore.NewData(uuid, roitype, "myroi2", config)
if err != nil {
t.Errorf("Error creating new roi instance: %v\n", err)
}
roi2, ok := dataservice2.(*Data)
if !ok {
t.Errorf("Returned new data instance 2 is not roi.Data\n")
}
if roi1.InstanceID() == roi2.InstanceID() {
t.Errorf("Instance IDs should be different: %d == %d\n",
roi1.InstanceID(), roi2.InstanceID())
}
// Test persistence of storage.
roi2.MinZ = 13
roi2.MaxZ = 3098
gobBytes, err := roi2.GobEncode()
if err != nil {
t.Fatalf("Could not Gob encode roi: %v\n", err)
}
var received Data
if err = received.GobDecode(gobBytes); err != nil {
t.Fatalf("Could not decode Gob-encoded roi: %v\n", err)
}
if !roi2.Data.Equals(received.Data) {
t.Errorf("ROI base Data has bad roundtrip:\nOriginal:\n%v\nReceived:\n%v\n",
*(roi2.Data), *(received.Data))
}
if !reflect.DeepEqual(roi2.Properties, received.Properties) {
t.Errorf("ROI extended properties has bad roundtrip:\nOriginal:\n%v\nReceived:\n%v\n",
roi2.Properties, received.Properties)
}
}
示例4: TestKeyvalueRequests
func TestKeyvalueRequests(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, versionID := initTestRepo()
testRequest(t, uuid, versionID, "mykeyvalue")
}
示例5: TestVoxelsInstanceCreation
func TestVoxelsInstanceCreation(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid := dvid.UUID(server.NewTestRepo(t))
// Create new voxels instance with optional parameters
name := "grayscale"
metadata := fmt.Sprintf(`{
"typename": "uint8blk",
"dataname": %q,
"blocksize": "64,43,28",
"VoxelSize": "13.1, 14.2, 15.3",
"VoxelUnits": "picometers,nanometers,microns"
}`, name)
apiStr := fmt.Sprintf("%srepo/%s/instance", server.WebAPIPath, uuid)
server.TestHTTP(t, "POST", apiStr, bytes.NewBufferString(metadata))
// Get metadata and make sure optional settings have been set.
apiStr = fmt.Sprintf("%snode/%s/%s/info", server.WebAPIPath, uuid, name)
result := server.TestHTTP(t, "GET", apiStr, nil)
var parsed = struct {
Base struct {
TypeName, Name string
}
Extended struct {
BlockSize dvid.Point3d
VoxelSize dvid.NdFloat32
VoxelUnits dvid.NdString
}
}{}
if err := json.Unmarshal(result, &parsed); err != nil {
t.Fatalf("Error parsing JSON response of new instance metadata: %v\n", err)
}
if parsed.Base.Name != name {
t.Errorf("Parsed new instance has unexpected name: %s != %s (expected)\n",
parsed.Base.Name, name)
}
if parsed.Base.TypeName != "uint8blk" {
t.Errorf("Parsed new instance has unexpected type name: %s != uint8blk (expected)\n",
parsed.Base.TypeName)
}
if !parsed.Extended.BlockSize.Equals(dvid.Point3d{64, 43, 28}) {
t.Errorf("Bad block size in new uint8blk instance: %s\n", parsed.Extended.BlockSize)
}
if !parsed.Extended.VoxelSize.Equals(dvid.NdFloat32{13.1, 14.2, 15.3}) {
t.Errorf("Bad voxel size in new uint8blk instance: %s\n", parsed.Extended.VoxelSize)
}
if parsed.Extended.VoxelUnits[0] != "picometers" {
t.Errorf("Got %q for X voxel units, not picometers\n", parsed.Extended.VoxelUnits[0])
}
if parsed.Extended.VoxelUnits[1] != "nanometers" {
t.Errorf("Got %q for X voxel units, not picometers\n", parsed.Extended.VoxelUnits[0])
}
if parsed.Extended.VoxelUnits[2] != "microns" {
t.Errorf("Got %q for X voxel units, not picometers\n", parsed.Extended.VoxelUnits[0])
}
}
示例6: TestLog
func TestLog(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid := createRepo(t)
// Post a log
payload := bytes.NewBufferString(`{"log": ["line1", "line2", "some more stuff in a line"]}`)
apiStr := fmt.Sprintf("%snode/%s/log", WebAPIPath, uuid)
TestHTTP(t, "POST", apiStr, payload)
// Verify it was saved.
r := TestHTTP(t, "GET", apiStr, nil)
jsonResp := make(map[string][]string)
if err := json.Unmarshal(r, &jsonResp); err != nil {
t.Fatalf("Unable to unmarshal log response: %s\n", string(r))
}
if len(jsonResp) != 1 {
t.Errorf("Bad log return: %s\n", string(r))
}
data, ok := jsonResp["log"]
if !ok {
t.Fatalf("No 'log' data returned: %s\n", string(r))
}
if len(data) != 3 {
t.Fatalf("Got wrong # of lines in log: %v\n", data)
}
testLog(t, data[0], "line1")
testLog(t, data[1], "line2")
testLog(t, data[2], "some more stuff in a line")
// Add some more to log
payload = bytes.NewBufferString(`{"log": ["line4", "line5"]}`)
apiStr = fmt.Sprintf("%snode/%s/log", WebAPIPath, uuid)
TestHTTP(t, "POST", apiStr, payload)
// Verify it was appended.
r = TestHTTP(t, "GET", apiStr, nil)
jsonResp = make(map[string][]string)
if err := json.Unmarshal(r, &jsonResp); err != nil {
t.Fatalf("Unable to unmarshal log response: %s\n", string(r))
}
if len(jsonResp) != 1 {
t.Errorf("Bad log return: %s\n", string(r))
}
data, ok = jsonResp["log"]
if !ok {
t.Fatalf("No 'log' data returned: %s\n", string(r))
}
if len(data) != 5 {
t.Errorf("Got wrong # of lines in log: %v\n", data)
}
testLog(t, data[3], "line4")
testLog(t, data[4], "line5")
}
示例7: TestCommitBranchMerge
func TestCommitBranchMerge(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid := createRepo(t)
// Shouldn't be able to create branch on open node.
branchReq := fmt.Sprintf("%snode/%s/branch", WebAPIPath, uuid)
TestBadHTTP(t, "POST", branchReq, nil)
// Commit it.
payload := bytes.NewBufferString(`{"note": "This is my test commit", "log": ["line1", "line2", "some more stuff in a line"]}`)
apiStr := fmt.Sprintf("%snode/%s/commit", WebAPIPath, uuid)
TestHTTP(t, "POST", apiStr, payload)
// Make sure committed nodes can only be read.
// We shouldn't be able to write to log.
payload = bytes.NewBufferString(`{"log": ["line1", "line2", "some more stuff in a line"]}`)
apiStr = fmt.Sprintf("%snode/%s/log", WebAPIPath, uuid)
TestBadHTTP(t, "POST", apiStr, payload)
// Should be able to create branch now that we've committed parent.
respData := TestHTTP(t, "POST", branchReq, nil)
resp := struct {
Child string `json:"child"`
}{}
if err := json.Unmarshal(respData, &resp); err != nil {
t.Errorf("Expected 'child' JSON response. Got %s\n", string(respData))
}
parent1 := dvid.UUID(resp.Child)
// Create a sibling.
respData = TestHTTP(t, "POST", branchReq, nil)
if err := json.Unmarshal(respData, &resp); err != nil {
t.Errorf("Expected 'child' JSON response. Got %s\n", string(respData))
}
parent2 := dvid.UUID(resp.Child)
// Commit both parents
payload = bytes.NewBufferString(`{"note": "This is first parent"}`)
apiStr = fmt.Sprintf("%snode/%s/commit", WebAPIPath, parent1)
TestHTTP(t, "POST", apiStr, payload)
payload = bytes.NewBufferString(`{"note": "This is second parent"}`)
apiStr = fmt.Sprintf("%snode/%s/commit", WebAPIPath, parent2)
TestHTTP(t, "POST", apiStr, payload)
// Merge the two disjoint branches.
mergeJSON := fmt.Sprintf(`{"mergeType": "conflict-free", "note": "This is my merged node", "parents": [%q, %q]}`, parent1[:7], parent2)
payload = bytes.NewBufferString(mergeJSON)
apiStr = fmt.Sprintf("%srepo/%s/merge", WebAPIPath, parent1)
TestHTTP(t, "POST", apiStr, payload)
}
示例8: TestROIPartition
func TestROIPartition(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
// Create the ROI dataservice.
uuid, versionID := initTestRepo()
config := dvid.NewConfig()
dataservice, err := datastore.NewData(uuid, roitype, "roi", config)
if err != nil {
t.Errorf("Error creating new roi instance: %v\n", err)
}
data, ok := dataservice.(*Data)
if !ok {
t.Errorf("Returned new data instance is not roi.Data\n")
}
// PUT an ROI
roiRequest := fmt.Sprintf("%snode/%s/%s/roi", server.WebAPIPath, uuid, data.DataName())
req, err := http.NewRequest("POST", roiRequest, getSpansJSON(testSpans))
if err != nil {
t.Errorf("Unsuccessful POST request (%s): %v\n", roiRequest, err)
}
ctx := datastore.NewVersionedCtx(data, versionID)
w := httptest.NewRecorder()
data.ServeHTTP(uuid, ctx, w, req)
if w.Code != http.StatusOK {
t.Errorf("Bad server response roi POST, status %s, for roi %q\n", w.Code, data.DataName())
}
// Request the standard subvolume partitioning
partitionReq := fmt.Sprintf("%snode/%s/%s/partition?batchsize=5&optimized=true", server.WebAPIPath, uuid,
data.DataName())
req, err = http.NewRequest("GET", partitionReq, nil)
if err != nil {
t.Errorf("Unsuccessful GET request (%s): %v\n", partitionReq, err)
}
w = httptest.NewRecorder()
data.ServeHTTP(uuid, ctx, w, req)
if w.Code != http.StatusOK {
t.Errorf("Bad server response roi GET, status %s, for roi %q\n", w.Code, data.DataName())
}
var subvolJSON, expectedJSON interface{}
response := w.Body.Bytes()
if err := json.Unmarshal(response, &subvolJSON); err != nil {
t.Errorf("Can't unmarshal JSON: %s\n", w.Body.Bytes())
}
json.Unmarshal([]byte(expectedPartition), &expectedJSON)
if !reflect.DeepEqual(subvolJSON, expectedJSON) {
t.Errorf("Error doing optimized subvolume partitioning. Got bad result:\n%s\n",
string(response))
}
}
示例9: TestBasic
func TestBasic(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, _ := initTestRepo()
config := dvid.NewConfig()
_, err := datastore.NewData(uuid, dtype, "instance1", config)
if err != nil {
t.Errorf("Error creating new multichan16 instance: %v\n", err)
}
}
示例10: TestDiamondGetOnMerge
// Test added after error in getting two paths to the same ancestor k/v after merge.
func TestDiamondGetOnMerge(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, _ := initTestRepo()
config := dvid.NewConfig()
dataservice, err := datastore.NewData(uuid, kvtype, "mergetest", config)
if err != nil {
t.Fatalf("Error creating new keyvalue instance: %v\n", err)
}
data, ok := dataservice.(*Data)
if !ok {
t.Fatalf("Returned new data instance is not roi.Data\n")
}
// PUT a value
key1 := "mykey"
value1 := "some stuff"
key1req := fmt.Sprintf("%snode/%s/%s/key/%s", server.WebAPIPath, uuid, data.DataName(), key1)
server.TestHTTP(t, "POST", key1req, strings.NewReader(value1))
if err = datastore.Commit(uuid, "my commit msg", []string{"stuff one", "stuff two"}); err != nil {
t.Errorf("Unable to lock root node %s: %v\n", uuid, err)
}
uuid2, err := datastore.NewVersion(uuid, "first child", nil)
if err != nil {
t.Fatalf("Unable to create 1st child off root %s: %v\n", uuid, err)
}
if err = datastore.Commit(uuid2, "first child", nil); err != nil {
t.Errorf("Unable to commit node %s: %v\n", uuid2, err)
}
uuid3, err := datastore.NewVersion(uuid, "second child", nil)
if err != nil {
t.Fatalf("Unable to create 2nd child off root %s: %v\n", uuid, err)
}
if err = datastore.Commit(uuid3, "second child", nil); err != nil {
t.Errorf("Unable to commit node %s: %v\n", uuid3, err)
}
child, err := datastore.Merge([]dvid.UUID{uuid2, uuid3}, "merging stuff", datastore.MergeConflictFree)
if err != nil {
t.Errorf("Error doing merge: %v\n", err)
}
// We should be able to see just the original uuid value of the k/v
childreq := fmt.Sprintf("%snode/%s/%s/key/%s", server.WebAPIPath, child, data.DataName(), key1)
returnValue := server.TestHTTP(t, "GET", childreq, nil)
if string(returnValue) != value1 {
t.Errorf("Error on merged child, key %q: expected %q, got %q\n", key1, value1, string(returnValue))
}
}
示例11: TestBlockAPI
func TestBlockAPI(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid, _ := initTestRepo()
grayscale := makeGrayscale(uuid, t, "grayscale")
// construct random blocks of data.
numBlockBytes := int32(grayscale.BlockSize().Prod())
testBlocks := 1001
var blockData []byte
for i := 0; i < testBlocks; i++ {
blockData = append(blockData, tests.RandomBytes(numBlockBytes)...)
}
// set start of span
x := rand.Int31()
y := rand.Int31()
z := rand.Int31()
// Test uncompressed roundtrip
// send the blocks
blockReq := fmt.Sprintf("%snode/%s/grayscale/blocks/%d_%d_%d/%d", server.WebAPIPath, uuid, x, y, z, testBlocks)
server.TestHTTP(t, "POST", blockReq, bytes.NewBuffer(blockData))
// read same span of blocks
returnedData := server.TestHTTP(t, "GET", blockReq, nil)
// make sure blocks are same
totBytes := testBlocks * int(numBlockBytes)
if len(returnedData) != totBytes {
t.Errorf("Returned %d bytes, expected %d bytes", len(returnedData), totBytes)
}
if !reflect.DeepEqual(returnedData, blockData) {
t.Errorf("Returned block data != original block data\n")
}
// We should get blank blocks at different z
z += 1
blockReq = fmt.Sprintf("%snode/%s/grayscale/blocks/%d_%d_%d/%d", server.WebAPIPath, uuid, x, y, z, testBlocks)
returnedData = server.TestHTTP(t, "GET", blockReq, nil)
if len(returnedData) != totBytes {
t.Errorf("Returned %d bytes, expected %d bytes", len(returnedData), totBytes)
}
for i, b := range returnedData {
if b != 0 {
t.Fatalf("Expected 0 at returned byte %d, got %d instead.\n", i, b)
}
}
}
示例12: TestCommitAndBranch
func TestCommitAndBranch(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
apiStr := fmt.Sprintf("%srepos", server.WebAPIPath)
r := server.TestHTTP(t, "POST", apiStr, nil)
var jsonResp map[string]interface{}
if err := json.Unmarshal(r, &jsonResp); err != nil {
t.Fatalf("Unable to unmarshal repo creation response: %s\n", string(r))
}
v, ok := jsonResp["root"]
if !ok {
t.Fatalf("No 'root' metadata returned: %s\n", string(r))
}
uuidStr, ok := v.(string)
if !ok {
t.Fatalf("Couldn't cast returned 'root' data (%v) into string.\n", v)
}
uuid := dvid.UUID(uuidStr)
// Shouldn't be able to create branch on open node.
branchReq := fmt.Sprintf("%snode/%s/branch", server.WebAPIPath, uuid)
server.TestBadHTTP(t, "POST", branchReq, nil)
// Add a keyvalue instance.
server.CreateTestInstance(t, uuid, "keyvalue", "mykv", dvid.Config{})
// Commit it.
payload := bytes.NewBufferString(`{"note": "This is my test commit", "log": ["line1", "line2", "some more stuff in a line"]}`)
apiStr = fmt.Sprintf("%snode/%s/commit", server.WebAPIPath, uuid)
server.TestHTTP(t, "POST", apiStr, payload)
// Make sure committed nodes can only be read.
// We shouldn't be able to write to keyvalue..
keyReq := fmt.Sprintf("%snode/%s/mykv/key/foo", server.WebAPIPath, uuid)
server.TestBadHTTP(t, "POST", keyReq, bytes.NewBufferString("some data"))
// Should be able to create branch now that we've committed parent.
respData := server.TestHTTP(t, "POST", branchReq, nil)
resp := struct {
Child dvid.UUID `json:"child"`
}{}
if err := json.Unmarshal(respData, &resp); err != nil {
t.Errorf("Expected 'child' JSON response. Got %s\n", string(respData))
}
// We should be able to write to that keyvalue now in the child.
keyReq = fmt.Sprintf("%snode/%s/mykv/key/foo", server.WebAPIPath, resp.Child)
server.TestHTTP(t, "POST", keyReq, bytes.NewBufferString("some data"))
}
示例13: TestDeleteInstance
func TestDeleteInstance(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid := createRepo(t)
// Shouldn't be able to delete instance without "imsure"
delReq := fmt.Sprintf("%srepo/%s/%s", WebAPIPath, uuid, "absent-name")
TestBadHTTP(t, "DELETE", delReq, nil)
// Shouldn't be able to delete an instance that doesn't exist.
delReq = fmt.Sprintf("%srepo/%s/%s?imsure=true", WebAPIPath, uuid, "absent-name")
TestBadHTTP(t, "DELETE", delReq, nil)
}
示例14: TestLabelsSyncing
func TestLabelsSyncing(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
uuid := dvid.UUID(server.NewTestRepo(t))
if len(uuid) < 5 {
t.Fatalf("Bad root UUID for new repo: %s\n", uuid)
}
// Create a labelblk instance
vol := labelVol{
size: dvid.Point3d{5, 5, 5}, // in blocks
blockSize: dvid.Point3d{32, 32, 32},
offset: dvid.Point3d{32, 64, 96},
}
vol.postLabelVolume(t, "labels", uuid)
// TODO -- Test syncing across labelblk, labelvol, labelsz.
}
示例15: TestDeleteInstance
func TestDeleteInstance(t *testing.T) {
tests.UseStore()
defer tests.CloseStore()
apiStr := fmt.Sprintf("%srepos", server.WebAPIPath)
r := server.TestHTTP(t, "POST", apiStr, nil)
var jsonResp map[string]interface{}
if err := json.Unmarshal(r, &jsonResp); err != nil {
t.Fatalf("Unable to unmarshal repo creation response: %s\n", string(r))
}
v, ok := jsonResp["root"]
if !ok {
t.Fatalf("No 'root' metadata returned: %s\n", string(r))
}
uuidStr, ok := v.(string)
if !ok {
t.Fatalf("Couldn't cast returned 'root' data (%v) into string.\n", v)
}
uuid := dvid.UUID(uuidStr)
// Add a data instance.
var config dvid.Config
server.CreateTestInstance(t, uuid, "keyvalue", "foo", config)
// Make sure it exists.
_, err := datastore.GetDataByUUID(uuid, "foo")
if err != nil {
t.Errorf("Couldn't create data instance 'foo'\n")
}
// Shouldn't be able to delete instance without "imsure"
delReq := fmt.Sprintf("%srepo/%s/%s", server.WebAPIPath, uuid, "foo")
server.TestBadHTTP(t, "DELETE", delReq, nil)
delReq = fmt.Sprintf("%srepo/%s/%s?imsure=true", server.WebAPIPath, uuid, "foo")
server.TestHTTP(t, "DELETE", delReq, nil)
// Make sure it no longer exists.
_, err = datastore.GetDataByUUID(uuid, "foo")
if err == nil {
t.Errorf("Shouldn't be able to access a deleted data instance 'foo'\n")
}
}