Skip to content

Commit

Permalink
[cli] Make tests not be sensitive to env
Browse files Browse the repository at this point in the history
commit 5315ff8 added these tests that
run shac nearly end-to-end, including automatic selection of reporting
mechanism. The reporting mechanism selection is sensitive to the
environment and in particular is somewhat picky about how the ResultDB
environment is set up, so the tests fail if they're run on a builder
with ResultDB enabled but without the process being wrapped by `rdb
stream`: https://ci.chromium.org/b/8768055331277189409

Change-Id: Idc006375834a225d207413a7962baad1083a8abf
Reviewed-on: https://fuchsia-review.googlesource.com/c/shac-project/shac/+/927713
Fuchsia-Auto-Submit: Oliver Newman <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Anthony Fandrianto <[email protected]>
  • Loading branch information
orn688 authored and CQ Bot committed Oct 5, 2023
1 parent 5315ff8 commit 247f779
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ func init() {
}

func TestMainErr(t *testing.T) {
t.Parallel()
// Override various env vars probed by `reporting.Get()` to prevent
// automatic selection of the reporter, which can lead to inconsistent
// behavior depending on the environment.
t.Setenv("LUCI_CONTEXT", "")
t.Setenv("GITHUB_RUN_ID", "")
t.Setenv("VSCODE_GIT_IPC_HANDLE", "")
t.Setenv("TERM", "dumb")

data := map[string]func(t *testing.T) (args []string, wantErr string){
"no shac.star files": func(t *testing.T) ([]string, string) {
root := t.TempDir()
Expand Down

0 comments on commit 247f779

Please sign in to comment.