...

Text file src/cmd/go/testdata/script/test_default_godebug_issue69203.txt

Documentation: cmd/go/testdata/script

     1# This is the case reported in issue #69203. Setting GO111MODULE
     2# off sets the Go version used to determine default GODEBUG settings
     3# to Go 1.20, flipping the httplaxcontentlength godebug's value to "1".
     4# Doing so causes net/http.TestReadResponseErrors to fail.
     5# Before CL 610875, the default GODEBUG was only sometimes used to generate the actionID
     6# for a link: if the binary being linked was package main, the default GODEBUG would be
     7# embedded in the build info, which is in turn used for the action id. But for a test
     8# of a non-main package, there would be no build info set and the default godebug would not
     9# be taken into account in the action id. So if the only difference between a test run was the
    10# default GODEBUG setting, the cached test result would be used (even though the
    11# binaries were different because they contained different default GODEBUG values).
    12# Now we explicitly add the default GODEBUG to the action id, so the test binaries' link actions
    13# have different actionIDs. That means that the cached test results (whose action ids
    14# are based on the test binaries' action ids) should only be used when the default GODEBUG matches.
    15
    16[short] skip 'runs go test'
    17
    18# Baseline: ensure TestReadResponseErrors fails with GODEBUG httplaxcontentlength=1.
    19env GO111MODULE=off
    20! go test net/http -run=^TestReadResponseErrors$
    21
    22# Ensure that it passes without httplaxcontentlength=1.
    23env GO111MODULE=on
    24go test net/http -run=^TestReadResponseErrors$
    25
    26# Make sure that the previous cached pass isn't reused when setting httplaxcontentlength=1.
    27env GO111MODULE=off
    28! go test net/http -run=^TestReadResponseErrors$

View as plain text