From 5228809a0ef9568acf90468fa714fd7821637bbe Mon Sep 17 00:00:00 2001 From: Bruno Meneguele Date: Tue, 29 Sep 2020 12:52:34 -0300 Subject: [PATCH] root: add default values to test setup 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 --- cmd/root_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/root_test.go b/cmd/root_test.go index 2673e68d..b0c4271d 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -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 {