oauth2-proxy icon indicating copy to clipboard operation
oauth2-proxy copied to clipboard

[Bug]: can't pass test due absent IPv6 support

Open k0ste opened this issue 6 months ago • 2 comments

OAuth2-Proxy Version

7.15.2

Provider

None

Expected Behaviour

Tests passed due DEVCONTAINER=1

Current Behaviour

One test failed, should be skipped due DEVCONTAINER=1 (disable ipv6 tests)

Steps To Reproduce

prepare() {
  export GOPATH="${srcdir}/gopath"
  export GOBIN="${GOPATH}/bin"
  export GOCACHE="${srcdir}/cache/go-cache"
  export GOMODCACHE="${srcdir}/cache/go"
  export GOTMPDIR="${srcdir}"
  eval "$(go env | grep -e "GOHOSTOS" -e "GOHOSTARCH")"
  mkdir -p "${GOPATH}/src/${_uri}"
  ln -snf "${srcdir}/${pkgname}-${pkgver}" "${GOPATH}/src/${_uri}/${pkgname}"
}

build() {
  cd "${GOPATH}/src/${_uri}/${pkgname}"
  eval "$(go env | grep -e "GOHOSTOS" -e "GOHOSTARCH")"
  GOOS="${GOHOSTOS}" GOARCH="${GOHOSTARCH}" \
  go build -x \
    -buildmode="pie" \
    -trimpath \
    -mod="readonly" \
    -modcacherw \
    -ldflags "-linkmode external -extldflags '${LDFLAGS}' \
    -X github.com/${pkgname}/${pkgname}/v7/pkg/version.VERSION=${pkgver}"
}

check() {
  cd "${GOPATH}/src/${_uri}/${pkgname}"
  DEVCONTAINER="1" go test -modcacherw -v -race ./...
}

Configuration details or additional information

=== RUN   TestHTTPSuite
Running Suite: HTTP - /srv/pkgbuild/oauth2-proxy/src/gopath/src/github.com/oauth2-proxy/oauth2-proxy/pkg/proxyhttp
===================================================================================================================================================
Random Seed: 1779973661

Will run 97 of 97 specs
••••••••••••••••••••••••••••S
------------------------------
• [FAILED] [0.003 seconds]
Server NewServer When creating the new server from the options [It] with a invalid fd IPv6 bind address
/srv/pkgbuild/oauth2-proxy/src/gopath/src/github.com/oauth2-proxy/oauth2-proxy/pkg/proxyhttp/server_test.go:388

  [FAILED] Unexpected error:
      <*net.OpError | 0xc0003be320>:
      listen tcp [::1]:0: bind: cannot assign requested address
      {
          Op: "listen",
          Net: "tcp",
          Source: nil,
          Addr: <*net.TCPAddr | 0xc00034c8d0>{
              IP: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
              Port: 0,
              Zone: "",
          },
          Err: <*os.SyscallError | 0xc0001d14c0>{
              Syscall: "bind",
              Err: <syscall.Errno>0x63,
          },
      }
  occurred
  In [It] at: /srv/pkgbuild/oauth2-proxy/src/gopath/src/github.com/oauth2-proxy/oauth2-proxy/pkg/proxyhttp/server_test.go:44 @ 05/28/26 20:07:42.889
------------------------------
SSSSSSSSSSSSSSSSSSS•••••••••••••••••SSSSSSSSSSS••••••••••••••••••••

Summarizing 1 Failure:
  [FAIL] Server NewServer When creating the new server from the options [It] with a invalid fd IPv6 bind address
  /srv/pkgbuild/oauth2-proxy/src/gopath/src/github.com/oauth2-proxy/oauth2-proxy/pkg/proxyhttp/server_test.go:44

Ran 66 of 97 Specs in 1.356 seconds
FAIL! -- 65 Passed | 1 Failed | 0 Pending | 31 Skipped
--- FAIL: TestHTTPSuite (1.37s)
FAIL
FAIL    github.com/oauth2-proxy/oauth2-proxy/v7/pkg/proxyhttp   1.392s

k0ste avatar May 28 '26 13:05 k0ste

Hi @k0ste! I'm Dosu and I’m helping the oauth2-proxy team.

This looks like a legitimate bug. The test at line 388 ("with a invalid fd IPv6 bind address") uses an IPv6 address ([::1]:0) in its fdAddr field but does not set the ipv6: true flag in its test entry [1]. The skip logic only triggers when in.ipv6 is true [2]:

if in.ipv6 {
    skipDevContainer()
}

Since ipv6: true is missing from that specific test case, skipDevContainer() is never called for it, so it runs regardless of DEVCONTAINER=1.

Other IPv6 tests in the same file correctly set ipv6: true or call skipDevContainer() directly in their BeforeEach blocks [3] [4]. The fix should be straightforward — adding ipv6: true to the test entry at line 388 would make it consistent with the rest of the IPv6 tests.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about oauth2-proxy Share Dosu with your team

dosubot[bot] avatar May 28 '26 13:05 dosubot[bot]

I'd like to take this. The "invalid fd IPv6 bind address" table entry is missing ipv6: true, so it isn't covered by the skipDevContainer() guard and tries to bind [::1]:0 even under DEVCONTAINER=1. PR incoming.

mateenali66 avatar May 29 '26 07:05 mateenali66