Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

data race in webhook tests #506

Closed
troyronda opened this issue Oct 16, 2019 · 3 comments · Fixed by #509
Closed

data race in webhook tests #506

troyronda opened this issue Oct 16, 2019 · 3 comments · Fixed by #509
Assignees
Labels
bug Something isn't working
Milestone

Comments

@troyronda
Copy link
Contributor

troyronda commented Oct 16, 2019

Unit test log from circle CI run:

 [aries-framework/agentd] 2019/10/16 20:57:33 UTC - webhook.listenAndStopAfterReceivingNotification.func1 -> INFO Sample webhook client just received webhook notification
 [aries-framework/agentd] 2019/10/16 20:57:33 UTC - webhook.sendNotification -> INFO Notification sent to http://localhost:33225/webhookListen1 successfully. 
==================
WARNING: DATA RACE
Write at 0x00c00021a030 by goroutine 28:
  github.com/hyperledger/aries-framework-go/pkg/restapi/webhook.TestWebhookDispatcherMultipleWebhooks()
      /home/circleci/project/pkg/restapi/webhook/webhook_test.go:71 +0x281
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:909 +0x199

Previous read at 0x00c00021a030 by goroutine 31:
  github.com/hyperledger/aries-framework-go/pkg/restapi/webhook.TestWebhookDispatcherMultipleWebhooks.func1()
      /home/circleci/project/pkg/restapi/webhook/webhook_test.go:73 +0x45

Goroutine 28 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:960 +0x651
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:1202 +0xa6
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:909 +0x199
  testing.runTests()
      /usr/local/go/src/testing/testing.go:1200 +0x521
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1117 +0x2ff
  main.main()
      _testmain.go:102 +0x337

Goroutine 31 (running) created at:
  github.com/hyperledger/aries-framework-go/pkg/restapi/webhook.TestWebhookDispatcherMultipleWebhooks()
      /home/circleci/project/pkg/restapi/webhook/webhook_test.go:72 +0x2e3
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:909 +0x199
==================
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.dispatch -> ERROR failed to post notification to http://localhost:33225/webhookListen1: Post http://localhost:33225/webhookListen1: dial tcp 127.0.0.1:33225: connect: connection refused
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.listenAndStopAfterReceivingNotification.func1 -> INFO Sample webhook client just received webhook notification
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.sendNotification -> INFO Notification sent to http://localhost:37813/webhookListen2 successfully. 
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.listenAndStopAfterReceivingNotification.func1 -> INFO Sample webhook client just received webhook notification
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.sendNotification -> INFO Notification sent to http://localhost:34699/webhookListen3 successfully. 
--- FAIL: TestWebhookDispatcherMultipleWebhooks (2.01s)
    testing.go:853: race detected during execution of test
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.listenAndStopAfterReceivingNotification.func1 -> INFO Sample webhook client just received webhook notification
 [aries-framework/agentd] 2019/10/16 20:57:35 UTC - webhook.sendNotification -> INFO Notification sent to http://localhost:38969/webhookListen4 successfully. 
FAIL
coverage: 88.9% of statements
FAIL	github.com/hyperledger/aries-framework-go/pkg/restapi/webhook	4.075s
@troyronda troyronda added the bug Something isn't working label Oct 16, 2019
@troyronda troyronda added this to the 0.1.0 milestone Oct 16, 2019
@sudeshrshetty
Copy link
Contributor

This test gonna be removed as part of #472
We don't need those tickers and those background goroutine which constantly runs in background to send notifications.

@DRK3 is currently working on #472 and this issue will be gone.

@sudeshrshetty
Copy link
Contributor

sudeshrshetty commented Oct 16, 2019

@DRK3 mention this bug while pushing your PR for #472

@DRK3
Copy link
Contributor

DRK3 commented Oct 17, 2019

@sudeshrshetty @troyronda I was actually able to come up with a fix pretty quickly. Small change: #509

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants