Skip to content

Enable go race detection in Conduit CI #173

@klingerf

Description

@klingerf

Conduit's go CI is configured to run tests with go test -v ./.... We should consider instead running go test -race -v ./..., to enable race detection.

This will require fixing a data race issue that already exists in our codebase:

go test -race -v ./pkg/shell
...
==================
WARNING: DATA RACE
Read at 0x00c42014c000 by goroutine 21:
  runtime.chansend()
      /usr/local/Cellar/go/1.9.2/libexec/src/runtime/chan.go:128 +0x0
  github.com/runconduit/conduit/pkg/shell.(*unixShell).AsyncStdout.func1()
      /Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell.go:43 +0x64

Previous write at 0x00c42014c000 by goroutine 20:
  runtime.closechan()
      /usr/local/Cellar/go/1.9.2/libexec/src/runtime/chan.go:313 +0x0
  github.com/runconduit/conduit/pkg/shell.TestWaitForCharacter.func2()
      /Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell_test.go:129 +0x225
  testing.tRunner()
      /usr/local/Cellar/go/1.9.2/libexec/src/testing/testing.go:746 +0x16c

Goroutine 21 (running) created at:
  github.com/runconduit/conduit/pkg/shell.(*unixShell).AsyncStdout()
      /Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell.go:43 +0x331
  github.com/runconduit/conduit/pkg/shell.TestWaitForCharacter.func2()
      /Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell_test.go:119 +0x123
  testing.tRunner()
      /usr/local/Cellar/go/1.9.2/libexec/src/testing/testing.go:746 +0x16c

Goroutine 20 (finished) created at:
  testing.(*T).Run()
      /usr/local/Cellar/go/1.9.2/libexec/src/testing/testing.go:789 +0x568
  github.com/runconduit/conduit/pkg/shell.TestWaitForCharacter()
      /Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell_test.go:116 +0x8c
  testing.tRunner()
      /usr/local/Cellar/go/1.9.2/libexec/src/testing/testing.go:746 +0x16c
==================
panic: send on closed channel

goroutine 51 [running]:
github.com/runconduit/conduit/pkg/shell.(*unixShell).AsyncStdout.func1(0xc42014e000, 0xc42014c000)
	/Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell.go:43 +0x65
created by github.com/runconduit/conduit/pkg/shell.(*unixShell).AsyncStdout
	/Users/kl/workspace/go/src/github.com/runconduit/conduit/pkg/shell/shell.go:43 +0x332
exit status 2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions