Skip to content

Race condition in make test-docker #127

Open
@natebrennand

Description

@natebrennand

Issue Summary

When running make test-docker locally, the first test executed by Go, TestGet, failed reliably.

When inspecting the logs from docker-compose, the Prism startup output was emitted long after the go tests executed and failed.
This makes me suspect that what I'm encountering is a startup issue where the Prism container isn't ready to accept requests before the go tests begin.
Mitigation suggestions are here: https://docs.docker.com/compose/startup-order/

Steps to Reproduce

  1. Run make test-docker
  2. Run docker-compose logs -f from examples/prism/ to see log output

Exception/Log

I added a log to better inspect the error occurring:

diff --git a/examples/go-client/helper/rest/api/v2010/api_test.go b/examples/go-client/helper/rest/api/v2010/api_test.go
index e75d78d..e56d02c 100644
--- a/examples/go-client/helper/rest/api/v2010/api_test.go
+++ b/examples/go-client/helper/rest/api/v2010/api_test.go
@@ -28,6 +28,7 @@ func TestMain(m *testing.M) {

 func TestGet(t *testing.T) {
        resp, err := testApiService.PageCredentialAws(nil, "", "")
+       t.Logf("err: %s", err)

Which then yielded this error:
prism-go-client-test-1 | {"Time":"2022-04-18T18:49:46.703409863Z","Action":"output","Package":"go-client/helper/rest/api/v2010","Test":"TestGet","Output":" api_test.go:31: err: Get \"http://prism_twilio:4010/v1/Credentials/AWS\": dial tcp 172.24.0.2:4010: connect: connection refused\n"}

Technical details:

  • twilio-go version: v0.24.0 (present main)
  • go version: 1.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: work in progressTwilio or the community is in the process of implementingtype: bugbug in the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions