Skip to content

Commit

Permalink
root: add default values to test setup
Browse files Browse the repository at this point in the history
Some tests depend on the default values of 'forkedFromRemote and 'forkRemote'
variables; these tests run internally calling the command Run() code, instead
of the launching the lab executable.  With that, the code that correctly sets
these vars is bypassed and thus they are left empty.  These test cases rely
only on the "origin" value, so setting it on the test setup should be fine.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
  • Loading branch information
bmeneg committed Sep 29, 2020
1 parent 6d1316d commit 5228809
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func TestMain(m *testing.M) {
}
lab.Init(host, u.Username, token, false)

// Make "origin" the default remote for test cases calling
// cmd.Run() directly, instead of launching the labBinaryPath
// for getting these vars correctly set through Execute().
forkedFromRemote = "origin"
forkRemote = "origin"
code := m.Run()

if err := os.Chdir(originalWd); err != nil {
Expand Down

0 comments on commit 5228809

Please sign in to comment.