Skip to content

[Bug]: TestNewDeviceCode/reader_error test failure with Go 1.24 #715

Open
@gibmat

Description

Preflight Checklist

  • I could not find a solution in the documentation, the existing issues or discussions
  • I have joined the ZITADEL chat

Version

3.34.2

Describe the problem caused by this bug

Go 1.24 changed the behavior of crypto/rand Read() to never fail. This is causing TestNewDeviceCode/reader_error to fail:

=== RUN   TestNewDeviceCode
=== RUN   TestNewDeviceCode/reader_error
fatal error: crypto/rand: failed to read random data (see https://go.dev/issue/66821): multiple Read calls return no data or error

goroutine 14 [running]:
crypto/rand.fatal({0xc000151e00?, 0xa46d45?})
	/usr/lib/go-1.24/src/runtime/panic.go:1038 +0x18
crypto/rand.Read({0xc000254490?, 0x10, 0x54a32d?})
	/usr/lib/go-1.24/src/crypto/rand/rand.go:79 +0xfb
github.com/zitadel/oidc/pkg/op.NewDeviceCode(0x10)
	/<<PKGBUILDDIR>>/_build/src/github.com/zitadel/oidc/pkg/op/device.go:168 +0x3b
github.com/zitadel/oidc/pkg/op_test.TestNewDeviceCode.func1.1()
	/<<PKGBUILDDIR>>/_build/src/github.com/zitadel/oidc/pkg/op/device_test.go:150 +0x25
github.com/zitadel/oidc/pkg/op_test.runWithRandReader({0xaf3c60?, 0xeec920?}, 0xc00005af60?)
	/<<PKGBUILDDIR>>/_build/src/github.com/zitadel/oidc/pkg/op/device_test.go:144 +0x8d
github.com/zitadel/oidc/pkg/op_test.TestNewDeviceCode.func1(0xc00024aa80?)
	/<<PKGBUILDDIR>>/_build/src/github.com/zitadel/oidc/pkg/op/device_test.go:149 +0x37
testing.tRunner(0xc00024aa80, 0xa54930)
	/usr/lib/go-1.24/src/testing/testing.go:1792 +0xf4
created by testing.(*T).Run in goroutine 13
	/usr/lib/go-1.24/src/testing/testing.go:1851 +0x413

goroutine 1 [chan receive]:
testing.(*T).Run(0xc000102380, {0xa28d4d?, 0xc000043b30?}, 0xa54628)
	/usr/lib/go-1.24/src/testing/testing.go:1859 +0x431
testing.runTests.func1(0xc000102380)
	/usr/lib/go-1.24/src/testing/testing.go:2279 +0x37
testing.tRunner(0xc000102380, 0xc000043c70)
	/usr/lib/go-1.24/src/testing/testing.go:1792 +0xf4
testing.runTests(0xc000132960, {0xe77060, 0x56, 0x56}, {0xecd2e0?, 0x7?, 0xecbc00?})
	/usr/lib/go-1.24/src/testing/testing.go:2277 +0x4b4
testing.(*M).Run(0xc00014ca00)
	/usr/lib/go-1.24/src/testing/testing.go:2142 +0x64a
main.main()
	_testmain.go:221 +0x9b

goroutine 13 [chan receive]:
testing.(*T).Run(0xc00024a8c0, {0xa25896?, 0x549ab3?}, 0xa54930)
	/usr/lib/go-1.24/src/testing/testing.go:1859 +0x431
github.com/zitadel/oidc/pkg/op_test.TestNewDeviceCode(0xc00024a8c0)
	/<<PKGBUILDDIR>>/_build/src/github.com/zitadel/oidc/pkg/op/device_test.go:148 +0x2b
testing.tRunner(0xc00024a8c0, 0xa54628)
	/usr/lib/go-1.24/src/testing/testing.go:1792 +0xf4
created by testing.(*T).Run in goroutine 1
	/usr/lib/go-1.24/src/testing/testing.go:1851 +0x413
FAIL	github.com/zitadel/oidc/pkg/op	0.597s

To reproduce

Run tests with go 1.24.

Screenshots

No response

Expected behavior

No response

Additional Context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions