projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '13501-subprocess32'
[arvados.git]
/
services
/
keepstore
/
azure_blob_volume_test.go
diff --git
a/services/keepstore/azure_blob_volume_test.go
b/services/keepstore/azure_blob_volume_test.go
index 60a7911768f009ef6209292d6c1e04b6cccbe6e7..1cb6dc380d0a24a002072b1a7465ef640882dd6c 100644
(file)
--- a/
services/keepstore/azure_blob_volume_test.go
+++ b/
services/keepstore/azure_blob_volume_test.go
@@
-536,9
+536,13
@@
func TestAzureBlobVolumeCreateBlobRace(t *testing.T) {
azureWriteRaceInterval = time.Second
azureWriteRacePollTime = time.Millisecond
azureWriteRaceInterval = time.Second
azureWriteRacePollTime = time.Millisecond
- allDone := make(chan struct{})
+ var wg sync.WaitGroup
+
v.azHandler.race = make(chan chan struct{})
v.azHandler.race = make(chan chan struct{})
+
+ wg.Add(1)
go func() {
go func() {
+ defer wg.Done()
err := v.Put(context.Background(), TestHash, TestBlock)
if err != nil {
t.Error(err)
err := v.Put(context.Background(), TestHash, TestBlock)
if err != nil {
t.Error(err)
@@
-547,21
+551,22
@@
func TestAzureBlobVolumeCreateBlobRace(t *testing.T) {
continuePut := make(chan struct{})
// Wait for the stub's Put to create the empty blob
v.azHandler.race <- continuePut
continuePut := make(chan struct{})
// Wait for the stub's Put to create the empty blob
v.azHandler.race <- continuePut
+ wg.Add(1)
go func() {
go func() {
+ defer wg.Done()
buf := make([]byte, len(TestBlock))
_, err := v.Get(context.Background(), TestHash, buf)
if err != nil {
t.Error(err)
}
buf := make([]byte, len(TestBlock))
_, err := v.Get(context.Background(), TestHash, buf)
if err != nil {
t.Error(err)
}
- close(allDone)
}()
// Wait for the stub's Get to get the empty blob
close(v.azHandler.race)
// Allow stub's Put to continue, so the real data is ready
// when the volume's Get retries
<-continuePut
}()
// Wait for the stub's Get to get the empty blob
close(v.azHandler.race)
// Allow stub's Put to continue, so the real data is ready
// when the volume's Get retries
<-continuePut
- // Wait for
volume's Get to return the real data
- <-allDone
+ // Wait for
Get() and Put() to finish
+ wg.Wait()
}
func TestAzureBlobVolumeCreateBlobRaceDeadline(t *testing.T) {
}
func TestAzureBlobVolumeCreateBlobRaceDeadline(t *testing.T) {