Skip to content

Run functional and NFR tests with --race #1857

Open
@lucacome

Description

@lucacome

As a maintainer of NGF
I want to run my tests with --race
So that I can catch errors in my tests that may result in inconsistent failures/successes

Acceptance

  • NGF functional tests are run with the --race flag
  • All tests pass consistently.

Running the tests with --race results in


==================
WARNING: DATA RACE
Write at 0x00c0004716d0 by goroutine 97:
  bytes.(*Buffer).Write()
      /opt/hostedtoolcache/go/1.22.2/x64/src/bytes/buffer.go:176 +0x3d
  fmt.Fprintf()
      /opt/hostedtoolcache/go/1.22.2/x64/src/fmt/print.go:225 +0xab
  k8s.io/client-go/tools/portforward.(*PortForwarder).handleConnection()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:[33](https://github.com/nginxinc/nginx-gateway-fabric/actions/runs/8715168312/job/23906995652?pr=1833#step:13:34)5 +0x19d
  k8s.io/client-go/tools/portforward.(*PortForwarder).waitForConnection.gowrap1()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:316 +0x6b

Previous write at 0x00c0004716d0 by goroutine 52:
  bytes.(*Buffer).Write()
      /opt/hostedtoolcache/go/1.22.2/x64/src/bytes/buffer.go:176 +0x3d
  fmt.Fprintf()
      /opt/hostedtoolcache/go/1.22.2/x64/src/fmt/print.go:225 +0xab
  k8s.io/client-go/tools/portforward.(*PortForwarder).getListener()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:294 +0x728
  k8s.io/client-go/tools/portforward.(*PortForwarder).listenOnPortAndAddress()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:268 +0x8b
  k8s.io/client-go/tools/portforward.(*PortForwarder).listenOnPort()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:248 +0x22b
  k8s.io/client-go/tools/portforward.(*PortForwarder).forward()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:212 +0xcd
  k8s.io/client-go/tools/portforward.(*PortForwarder).ForwardPorts()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:200 +0x329
  github.com/nginxinc/nginx-gateway-fabric/tests/framework.PortForward.func1()
      /home/runner/work/nginx-gateway-fabric/nginx-gateway-fabric/tests/framework/portforward.go:45 +0x2e

Goroutine 97 (running) created at:
  k8s.io/client-go/tools/portforward.(*PortForwarder).waitForConnection()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:316 +0x84
  k8s.io/client-go/tools/portforward.(*PortForwarder).listenOnPortAndAddress.gowrap1()
      /home/runner/go/pkg/mod/k8s.io/[email protected]/tools/portforward/portforward.go:273 +0x6b

Goroutine 52 (running) created at:
  github.com/nginxinc/nginx-gateway-fabric/tests/framework.PortForward()
      /home/runner/work/nginx-gateway-fabric/nginx-gateway-fabric/tests/framework/portforward.go:[44](https://github.com/nginxinc/nginx-gateway-fabric/actions/runs/8715168312/job/23906995652?pr=1833#step:13:45) +0x819
  github.com/nginxinc/nginx-gateway-fabric/tests/suite.setup()
      /home/runner/work/nginx-gateway-fabric/nginx-gateway-fabric/tests/suite/system_suite_test.go:180 +0x1ba8
  github.com/nginxinc/nginx-gateway-fabric/tests/suite.init.func4()
      /home/runner/work/nginx-gateway-fabric/nginx-gateway-fabric/tests/suite/system_suite_test.go:258 +0x2c4
  github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3()
      /home/runner/go/pkg/mod/github.com/onsi/ginkgo/[email protected]/internal/node.go:[47](https://github.com/nginxinc/nginx-gateway-fabric/actions/runs/8715168312/job/23906995652?pr=1833#step:13:48)2 +0x2e
  github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3()
      /home/runner/go/pkg/mod/github.com/onsi/ginkgo/[email protected]/internal/suite.go:889 +0x12b
==================

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinedRequirements are refined and the issue is ready to be implemented.size/mediumEstimated to be completed within a weektestsPull requests that update tests

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions