Skip to content

Commit

Permalink
cmd/cue/cmd: use the new goproxytest.NewTestServer
Browse files Browse the repository at this point in the history
Which avoids chatty tests logging directly to stderr:

    $ go test
    go proxy: no archive externalmod.test v1.0.0
    go proxy: no archive externalmod.test/imports/root v1.0.0
    go proxy: no archive externalmod.test v1.0.0
    PASS
    ok  	cuelang.org/go/cmd/cue/cmd	3.314s

Now these log lines are part of TestScript, and shown only with -v:

    $ go test -run TestScript/get_go_non_local -v
    [...]
    === NAME  TestScript
        proxy.go:225: go proxy: no archive externalmod.test v1.0.0
        proxy.go:225: go proxy: no archive externalmod.test v1.0.0
        proxy.go:225: go proxy: no archive externalmod.test/imports/root v1.0.0

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I073b9b284694900634f9bc315813c6579bafa03d
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201550
Reviewed-by: Roger Peppe <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mvdan committed Sep 20, 2024
1 parent 7352390 commit 687464e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions cmd/cue/cmd/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ func TestLatest(t *testing.T) {
}

func TestScript(t *testing.T) {
srv, err := goproxytest.NewServer(filepath.Join("testdata", "mod"), "")
if err != nil {
t.Fatalf("cannot start proxy: %v", err)
}
t.Cleanup(srv.Close)
srv := goproxytest.NewTestServer(t, filepath.Join("testdata", "mod"), "")
p := testscript.Params{
Dir: filepath.Join("testdata", "script"),
UpdateScripts: cuetest.UpdateGoldenFiles,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/opencontainers/image-spec v1.1.0
github.com/pelletier/go-toml/v2 v2.2.2
github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0
github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21
github.com/rogpeppe/go-internal v1.12.1-0.20240920093810-3a65db189041
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/tetratelabs/wazero v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 h1:sadMIsgmHpEOGbUs6VtHBXRR1OHevnj7hLx9ZcdNGW4=
github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0/go.mod h1:jgxiZysxFPM+iWKwQwPR+y+Jvo54ARd4EisXxKYpB5c=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21 h1:igWZJluD8KtEtAgRyF4x6lqcxDry1ULztksMJh2mnQE=
github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21/go.mod h1:RMRJLmBOqWacUkmJHRMiPKh1S1m3PA7Zh4W80/kWPpg=
github.com/rogpeppe/go-internal v1.12.1-0.20240920093810-3a65db189041 h1:aI+8qoYUwVfAADK+0/9qk9pTqNz8+pKa2OU47wBaUdU=
github.com/rogpeppe/go-internal v1.12.1-0.20240920093810-3a65db189041/go.mod h1:RMRJLmBOqWacUkmJHRMiPKh1S1m3PA7Zh4W80/kWPpg=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
Expand Down

0 comments on commit 687464e

Please sign in to comment.