"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
cmd/gitannex: Prevent tests from hanging when assertion fails
Dan McArdle4d38424e6cbb
diff --git a/cmd/gitannex/gitannex_test.go b/cmd/gitannex/gitannex_test.goindex 7e1ad4cdb..889ca7dbf 100644--- a/cmd/gitannex/gitannex_test.go+++ b/cmd/gitannex/gitannex_test.go@@ -10,7 +10,6 @@ import ("regexp""runtime""strings"- "sync""testing""time"@@ -1393,23 +1392,27 @@ func TestGitAnnexFstestBackendCases(t *testing.T) {handle.remoteName = remoteNamehandle.remotePrefix = remotePath- var wg sync.WaitGroup- wg.Add(1)+ serverErrorChan := make(chan error)go func() {- err := handle.server.run()-- if testCase.expectedError == "" {- require.NoError(t, err)- } else {- require.ErrorContains(t, err, testCase.expectedError)- }-- wg.Done()+ // Run the gitannex server and send the result back to the+ // goroutine associated with `t`. We can't use `require` here+ // because it could call `t.FailNow()`, which says it must be+ // called on the goroutine associated with the test.+ serverErrorChan <- handle.server.run()}()- defer wg.Wait()testCase.testProtocolFunc(t, &handle)++ serverError, ok := <-serverErrorChan+ require.True(t, ok, "Should receive one error/nil from server")+ require.Empty(t, serverErrorChan)++ if testCase.expectedError == "" {+ require.NoError(t, serverError)+ } else {+ require.ErrorContains(t, serverError, testCase.expectedError)+ }})}}