Skip to content

x/telemetry/godev/cmd/telemetrygodev: TestConfig fails when the ENV environment variable is set #62138

@bcmills

Description

@bcmills

https://build.golang.org/log/01632ff0d1e2a2a8aeeca54449561a80220e9296:

--- FAIL: TestConfig (0.00s)
    config_test.go:25: Config() = &{8080 go-telemetry localhost:8081 .localstorage /root/.shrc-telemetry-uploaded ../config/config.json 102400 10m0s false false}, want &{8080 go-telemetry localhost:8081 .localstorage local-telemetry-uploaded ../config/config.json 102400 10m0s false false}
FAIL
FAIL	golang.org/x/telemetry/godev/cmd/telemetrygodev	0.124s

This appears to be due to the use of the ENV environment variable for configuration:
https://go.googlesource.com/telemetry/+/b0bf2e6e269ce288c82914e7d126bfe345aa84e9/godev/cmd/telemetrygodev/config.go#75

Per https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html#tag_20_117_08, the standard meaning of the ENV variable is:

ENV
This variable, when and only when an interactive shell is invoked, shall be subjected to parameter expansion (see Parameter Expansion) by the shell, and the resulting value shall be used as a pathname of a file containing shell commands to execute in the current environment. The file need not be executable. If the expanded value of ENV is not an absolute pathname, the results are unspecified. ENV shall be ignored if the real and effective user IDs or real and effective group IDs of the process are different.

If godev/cmd/telemetrygodev needs a configuration variable to use for a different, Go-specific purpose, it should use a Go-specific variable name. (And probably the same is true for the PORT variable. 😅)

(attn @jamalc @hyangah @pjweinb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.telemetryx/telemetry issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions