- Notifications
You must be signed in to change notification settings - Fork1k
fix: Leaking yamux session after HTTP handler is closed#329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -122,7 +122,7 @@ jobs: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-2022 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Per our discussion in slack - we may want to consider bumping the cache in one of these ways:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ahh that's a great idea! Changing now. | ||
steps: | ||
- uses: actions/checkout@v2 | ||
@@ -138,9 +138,9 @@ jobs: | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{matrix.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{matrix.os }}-go- | ||
- run: go install gotest.tools/gotestsum@latest | ||
@@ -150,9 +150,13 @@ jobs: | ||
terraform_wrapper: false | ||
- name: Test with Mock Database | ||
shell: bash | ||
env: | ||
GOCOUNT: ${{ runner.os == 'Windows' && 3 || 5 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Nice addition 👍 | ||
GOMAXPROCS: ${{ runner.os == 'Windows' && 1 || 2 }} | ||
run: gotestsum --junitfile="gotests.xml" --packages="./..." -- | ||
-covermode=atomic -coverprofile="gotests.coverage" | ||
-timeout=3m -count=$GOCOUNT -race -short -failfast | ||
- name: Upload DataDog Trace | ||
if: (success() || failure()) && github.actor != 'dependabot[bot]' | ||
@@ -166,10 +170,10 @@ jobs: | ||
if: runner.os == 'Linux' | ||
run: DB=true gotestsum --junitfile="gotests.xml" --packages="./..." -- | ||
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m | ||
-count=1 -race -parallel=2 -failfast | ||
- name: Upload DataDog Trace | ||
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux' | ||
env: | ||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} | ||
DD_DATABASE: postgresql | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,6 +4,7 @@ import ( | ||
"context" | ||
"database/sql" | ||
"io" | ||
"net" | ||
"net/http/httptest" | ||
"net/url" | ||
"os" | ||
@@ -59,7 +60,13 @@ func New(t *testing.T) *codersdk.Client { | ||
Database: db, | ||
Pubsub: pubsub, | ||
}) | ||
srv := httptest.NewUnstartedServer(handler) | ||
srv.Config.BaseContext = func(_ net.Listener) context.Context { | ||
ctx, cancelFunc := context.WithCancel(context.Background()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Nice catch... It's surprising that this is necessary, but glad you found it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It genuinely amazed me. | ||
t.Cleanup(cancelFunc) | ||
return ctx | ||
} | ||
srv.Start() | ||
serverURL, err := url.Parse(srv.URL) | ||
require.NoError(t, err) | ||
t.Cleanup(srv.Close) | ||