Skip to content

TestWriteConfigFileIsNotWorldReadable fails with udash.json: no such file or directory #10871

Open
awhite0030/updatecli
#49

Description

@lemeurherve

On both MacOS machines, udash's config spec test is failing with:

--- FAIL: TestWriteConfigFileIsNotWorldReadable (0.00s)
    config_spec_test.go:71: 
                Error Trace:    /Users/vv/oss/updatecli/pkg/core/udash/config_spec_test.go:71
                Error:          Received unexpected error:
                                stat /var/folders/tp/wg7m13056jjgb2z1_jv07j1r0000gn/T/TestWriteConfigFileIsNotWorldReadable1766830092/001/updatecli/udash.json: no such file or directory
                Test:           TestWriteConfigFileIsNotWorldReadable
time="2026-10-16T00:25:35+02:00" level=info msg="Successfully logged in to http://127.0.0.1:60640 as Jane."
time="2026-10-16T00:25:35+02:00" level=info msg="Successfully logged in to http://127.0.0.1:60644."
time="2026-10-16T00:25:35+02:00" level=info msg="Successfully logged in to http://127.0.0.1:60646 as user-1."
time="2026-10-16T00:25:35+02:00" level=info msg="Successfully logged in to http://127.0.0.1:60649."
time="2026-10-16T00:25:35+02:00" level=info msg="Successfully logged in to http://127.0.0.1:60652 as user-1."
time="2026-10-16T00:25:35+02:00" level=info msg="Successfully logged in to http://127.0.0.1:60654 as user-1."
time="2026-10-16T00:25:35+02:00" level=info msg="Logged out of https://app.updatecli.io locally. The token stays valid until you delete it from https://app.updatecli.io/profile/tokens"
time="2026-10-16T00:25:35+02:00" level=info msg="Logged out of https://udash.example.com locally. The token stays valid until you delete it from https://udash.example.com/profile/tokens"
time="2026-10-16T00:25:35+02:00" level=info msg="Logged out of https://app.updatecli.io/api locally. The token stays valid until you delete it from https://app.updatecli.io/api/profile/tokens"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
time="2026-10-16T00:25:35+02:00" level=info msg="Publishing report to Udash"
FAIL
coverage: 74.9% of statements
FAIL    github.com/updatecli/updatecli/pkg/core/udash   6.421s

useTempConfigDir assumes the config file lives directly under HOME, but os.UserConfigDir() returns $HOME/Library/Application Support on mac:

$ tmp=$(mktemp /tmp/main-XXXXXX.go)
cat > "$tmp" <<'EOF'
package main

import (
        "fmt"
        "os"
)

func main() {
        dir, err := os.UserConfigDir()
        if err != nil {
                panic(err)
        }
        fmt.Println(dir)
}
EOF
go run "$tmp"
rm "$tmp"
/Users/vv/Library/Application Support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingudashAll things related to Udash

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions