diff --git a/integration/replicated/pull_test.go b/integration/replicated/pull_test.go index ee8d45a146..352f181e61 100644 --- a/integration/replicated/pull_test.go +++ b/integration/replicated/pull_test.go @@ -5,14 +5,25 @@ import ( "path" "testing" + "github.com/golang/mock/gomock" "github.com/mholt/archiver/v3" "github.com/replicatedhq/kots/integration/util" "github.com/replicatedhq/kots/pkg/pull" + "github.com/replicatedhq/kots/pkg/store" + mock_store "github.com/replicatedhq/kots/pkg/store/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func Test_PullReplicated(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mockStore := mock_store.NewMockStore(ctrl) + store.SetStore(mockStore) + + // revert mock + defer store.SetStore(nil) + namespace := "test_ns" testDirs, err := ioutil.ReadDir("tests") diff --git a/pkg/store/store.go b/pkg/store/store.go index 2937e140aa..6b33204202 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -23,3 +23,12 @@ func GetStore() Store { func storeFromEnv() Store { return kotsstore.StoreFromEnv() } + +func SetStore(s Store) { + if s == nil { + hasStore = false + globalStore = nil + } + hasStore = true + globalStore = s +}