package main
import (
+ "bytes"
"encoding/base64"
"encoding/xml"
"flag"
http.DefaultTransport = &http.Transport{
Dial: (&azStubDialer{}).Dial,
}
+ azureWriteRaceInterval = time.Millisecond
+ azureWriteRacePollTime = time.Nanosecond
DoGenericVolumeTests(t, func(t *testing.T) TestableVolume {
return NewTestableAzureBlobVolume(t, false, azureStorageReplication)
})
http.DefaultTransport = &http.Transport{
Dial: (&azStubDialer{}).Dial,
}
+ azureWriteRaceInterval = time.Millisecond
+ azureWriteRacePollTime = time.Nanosecond
DoGenericVolumeTests(t, func(t *testing.T) TestableVolume {
return NewTestableAzureBlobVolume(t, true, azureStorageReplication)
})
azureWriteRacePollTime = 5 * time.Millisecond
v.PutRaw(TestHash, []byte{})
+
+ buf := new(bytes.Buffer)
+ v.IndexTo("", buf)
+ if buf.Len() != 0 {
+ t.Errorf("Index %+q should be empty", buf.Bytes())
+ }
+
v.TouchWithDate(TestHash, time.Now().Add(-1982 * time.Millisecond))
allDone := make(chan struct{})
case <-time.After(time.Second):
t.Error("Get should have stopped waiting for race when block was 2s old")
}
+
+ buf.Reset()
+ v.IndexTo("", buf)
+ if !bytes.HasPrefix(buf.Bytes(), []byte(TestHash+"+0")) {
+ t.Errorf("Index %+q should have %+q", buf.Bytes(), TestHash+"+0")
+ }
}
func (v *TestableAzureBlobVolume) PutRaw(locator string, data []byte) {