[ARVADOS] updated: 1.1.4-242-g6c56f80
Git user
git at public.curoverse.com
Wed May 9 13:19:13 EDT 2018
Summary of changes:
services/keepstore/azure_blob_volume_test.go | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
via 6c56f80642aae0ec0ff0bfc939ae33dd49e0ca6b (commit)
from 945621a7b37555462c67a1dca37f547624c4c90f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 6c56f80642aae0ec0ff0bfc939ae33dd49e0ca6b
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date: Wed May 9 13:11:55 2018 -0400
Avoid http client race in test case.
If we don't wait for Put() to return before returning from the test
case, CloseIdleConnections can cause Put() to fail, and the resulting
call to t.Error() panics the testing package.
"errType *url.Error, err Put
http://fakeaccountname.blob.127.0.0.1:42861/fakecontainername/e4d909c290d0fb1ca068ffaddf22cbd0:
net/http: HTTP/1.x transport connection broken: http:
CloseIdleConnections called"
"panic: Fail in goroutine after TestAzureBlobVolumeCreateBlobRace has completed"
No issue #
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>
diff --git a/services/keepstore/azure_blob_volume_test.go b/services/keepstore/azure_blob_volume_test.go
index 60a7911..1cb6dc3 100644
--- 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
- allDone := make(chan struct{})
+ var wg sync.WaitGroup
+
v.azHandler.race = make(chan chan struct{})
+
+ wg.Add(1)
go func() {
+ defer wg.Done()
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
+ wg.Add(1)
go func() {
+ defer wg.Done()
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 volume's Get to return the real data
- <-allDone
+ // Wait for Get() and Put() to finish
+ wg.Wait()
}
func TestAzureBlobVolumeCreateBlobRaceDeadline(t *testing.T) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list