Skip to content

Commit ae77d01

Browse files
committed
f
1 parent 46bfb45 commit ae77d01

File tree

19 files changed

+176
-77
lines changed

19 files changed

+176
-77
lines changed

api/controllers/kubernetes/install/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
199199
appcontroller.WithConfigValues(controller.configValues),
200200
appcontroller.WithAirgapBundle(controller.airgapBundle),
201201
appcontroller.WithPrivateCACertConfigMapName(""), // Private CA ConfigMap functionality not yet implemented for Kubernetes installations
202+
appcontroller.WithHelmClient(controller.hcli),
202203
)
203204
if err != nil {
204205
return nil, fmt.Errorf("create app install controller: %w", err)

api/integration/app/install/config_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/stretchr/testify/assert"
2626
"github.com/stretchr/testify/require"
2727
"github.com/stretchr/testify/suite"
28+
helmcli "helm.sh/helm/v3/pkg/cli"
2829
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930
)
3031

@@ -1053,7 +1054,7 @@ func TestAppInstallSuite(t *testing.T) {
10531054
)
10541055
require.NoError(t, err)
10551056
// Create the API with the install controller
1056-
return integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetLinux,
1057+
return integration.NewTargetLinuxAPIWithReleaseData(t, types.ModeInstall,
10571058
api.WithLinuxInstallController(controller),
10581059
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
10591060
api.WithLogger(logger.NewDiscardLogger()),
@@ -1071,10 +1072,11 @@ func TestAppInstallSuite(t *testing.T) {
10711072
kubernetesinstall.WithHelmClient(&helm.MockClient{}),
10721073
kubernetesinstall.WithLicense([]byte("spec:\n licenseID: test-license\n")),
10731074
kubernetesinstall.WithConfigValues(configValues),
1075+
kubernetesinstall.WithKubernetesEnvSettings(helmcli.New()),
10741076
)
10751077
require.NoError(t, err)
10761078
// Create the API with the install controller
1077-
return integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetKubernetes,
1079+
return integration.NewTargetKubernetesAPIWithReleaseData(t, types.ModeInstall,
10781080
api.WithKubernetesInstallController(controller),
10791081
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
10801082
api.WithLogger(logger.NewDiscardLogger()),

api/integration/app/upgrade/apppreflight_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/stretchr/testify/mock"
3737
"github.com/stretchr/testify/require"
3838
"github.com/stretchr/testify/suite"
39+
helmcli "helm.sh/helm/v3/pkg/cli"
3940
"k8s.io/cli-runtime/pkg/genericclioptions"
4041
)
4142

@@ -93,6 +94,7 @@ func (s *AppPreflightTestSuite) TestGetAppPreflightsStatus() {
9394
appcontroller.WithStateMachine(stateMachine),
9495
appcontroller.WithStore(mockStore),
9596
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
97+
appcontroller.WithHelmClient(&helm.MockClient{}),
9698
)
9799
require.NoError(s.T(), err)
98100

@@ -191,6 +193,7 @@ func (s *AppPreflightTestSuite) TestGetAppPreflightsStatus() {
191193
appcontroller.WithStateMachine(strictStateMachine),
192194
appcontroller.WithStore(mockStrictStore),
193195
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
196+
appcontroller.WithHelmClient(&helm.MockClient{}),
194197
)
195198
require.NoError(t, err)
196199

@@ -294,6 +297,7 @@ func (s *AppPreflightTestSuite) TestPostRunAppPreflights() {
294297
appcontroller.WithStateMachine(stateMachine),
295298
appcontroller.WithStore(mockStore),
296299
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
300+
appcontroller.WithHelmClient(&helm.MockClient{}),
297301
)
298302
require.NoError(t, err)
299303

@@ -344,6 +348,7 @@ func (s *AppPreflightTestSuite) TestPostRunAppPreflights() {
344348
appcontroller.WithStateMachine(stateMachine),
345349
appcontroller.WithStore(&store.MockStore{}),
346350
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
351+
appcontroller.WithHelmClient(&helm.MockClient{}),
347352
)
348353
require.NoError(t, err)
349354

@@ -381,6 +386,7 @@ func (s *AppPreflightTestSuite) TestPostRunAppPreflights() {
381386
appcontroller.WithStateMachine(stateMachine),
382387
appcontroller.WithStore(&store.MockStore{}),
383388
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
389+
appcontroller.WithHelmClient(&helm.MockClient{}),
384390
)
385391
require.NoError(t, err)
386392

@@ -461,6 +467,7 @@ func TestAppPreflightSuite(t *testing.T) {
461467
api.WithLinuxUpgradeController(controller),
462468
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
463469
api.WithLogger(logger.NewDiscardLogger()), // Prevent permission errors from log file creation
470+
api.WithHelmClient(&helm.MockClient{}),
464471
)
465472
require.NoError(t, err)
466473
return apiInstance
@@ -485,6 +492,7 @@ func TestAppPreflightSuite(t *testing.T) {
485492
kubernetesupgrade.WithReleaseData(rd),
486493
kubernetesupgrade.WithHelmClient(&helm.MockClient{}),
487494
kubernetesupgrade.WithAppController(appController),
495+
kubernetesupgrade.WithKubernetesEnvSettings(helmcli.New()),
488496
)
489497
require.NoError(t, err)
490498

@@ -502,6 +510,7 @@ func TestAppPreflightSuite(t *testing.T) {
502510
api.WithKubernetesUpgradeController(controller),
503511
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
504512
api.WithLogger(logger.NewDiscardLogger()),
513+
api.WithHelmClient(&helm.MockClient{}),
505514
)
506515
require.NoError(t, err)
507516
return apiInstance

api/integration/app/upgrade/config_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/stretchr/testify/mock"
2727
"github.com/stretchr/testify/require"
2828
"github.com/stretchr/testify/suite"
29+
helmcli "helm.sh/helm/v3/pkg/cli"
2930
)
3031

3132
type AppConfigTestSuite struct {
@@ -373,6 +374,7 @@ func TestAppConfigSuite(t *testing.T) {
373374
api.WithLinuxUpgradeController(controller),
374375
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
375376
api.WithLogger(logger.NewDiscardLogger()),
377+
api.WithHelmClient(&helm.MockClient{}),
376378
)
377379
require.NoError(t, err)
378380
return apiInstance
@@ -392,6 +394,7 @@ func TestAppConfigSuite(t *testing.T) {
392394
kubernetesupgrade.WithConfigValues(configValues),
393395
kubernetesupgrade.WithReleaseData(releaseData),
394396
kubernetesupgrade.WithHelmClient(&helm.MockClient{}),
397+
kubernetesupgrade.WithKubernetesEnvSettings(helmcli.New()),
395398
)
396399
require.NoError(t, err)
397400

@@ -404,6 +407,7 @@ func TestAppConfigSuite(t *testing.T) {
404407
api.WithKubernetesUpgradeController(controller),
405408
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
406409
api.WithLogger(logger.NewDiscardLogger()),
410+
api.WithHelmClient(&helm.MockClient{}),
407411
)
408412
require.NoError(t, err)
409413
return apiInstance

api/integration/app/upgrade/upgrade_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/stretchr/testify/mock"
3232
"github.com/stretchr/testify/require"
3333
"github.com/stretchr/testify/suite"
34+
helmcli "helm.sh/helm/v3/pkg/cli"
3435
)
3536

3637
type AppUpgradeTestSuite struct {
@@ -71,6 +72,7 @@ func (s *AppUpgradeTestSuite) TestPostUpgradeApp() {
7172
appcontroller.WithStateMachine(stateMachine),
7273
appcontroller.WithStore(mockStore),
7374
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
75+
appcontroller.WithHelmClient(&helm.MockClient{}),
7476
)
7577
require.NoError(t, err)
7678

@@ -127,6 +129,7 @@ func (s *AppUpgradeTestSuite) TestPostUpgradeApp() {
127129
appcontroller.WithStateMachine(stateMachine),
128130
appcontroller.WithStore(&store.MockStore{}),
129131
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
132+
appcontroller.WithHelmClient(&helm.MockClient{}),
130133
)
131134
require.NoError(t, err)
132135

@@ -192,6 +195,7 @@ func (s *AppUpgradeTestSuite) TestPostUpgradeApp() {
192195
appcontroller.WithStateMachine(stateMachine),
193196
appcontroller.WithStore(mockStore),
194197
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
198+
appcontroller.WithHelmClient(&helm.MockClient{}),
195199
)
196200
require.NoError(t, err)
197201

@@ -267,6 +271,7 @@ func (s *AppUpgradeTestSuite) TestGetAppUpgradeStatus() {
267271
appcontroller.WithStateMachine(stateMachine),
268272
appcontroller.WithStore(&store.MockStore{}),
269273
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
274+
appcontroller.WithHelmClient(&helm.MockClient{}),
270275
)
271276
require.NoError(t, err)
272277

@@ -308,6 +313,7 @@ func (s *AppUpgradeTestSuite) TestGetAppUpgradeStatus() {
308313
appcontroller.WithStateMachine(stateMachine),
309314
appcontroller.WithStore(&store.MockStore{}),
310315
appcontroller.WithReleaseData(integration.DefaultReleaseData()),
316+
appcontroller.WithHelmClient(&helm.MockClient{}),
311317
)
312318
require.NoError(t, err)
313319

@@ -376,6 +382,7 @@ func TestAppUpgradeSuite(t *testing.T) {
376382
api.WithLinuxUpgradeController(controller),
377383
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
378384
api.WithLogger(logger.NewDiscardLogger()),
385+
api.WithHelmClient(&helm.MockClient{}),
379386
)
380387
require.NoError(t, err)
381388
return apiInstance
@@ -395,9 +402,10 @@ func TestAppUpgradeSuite(t *testing.T) {
395402
kubernetesupgrade.WithReleaseData(rd),
396403
kubernetesupgrade.WithHelmClient(&helm.MockClient{}),
397404
kubernetesupgrade.WithAppController(appController),
405+
kubernetesupgrade.WithKubernetesEnvSettings(helmcli.New()),
398406
)
399407
require.NoError(t, err)
400-
return integration.NewAPIWithReleaseData(t, types.ModeUpgrade, types.InstallTargetKubernetes,
408+
return integration.NewTargetKubernetesAPIWithReleaseData(t, types.ModeUpgrade,
401409
api.WithKubernetesUpgradeController(controller),
402410
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
403411
api.WithLogger(logger.NewDiscardLogger()),

api/integration/auth/controller_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/replicatedhq/embedded-cluster/api/internal/utils"
1818
"github.com/replicatedhq/embedded-cluster/api/pkg/logger"
1919
"github.com/replicatedhq/embedded-cluster/api/types"
20+
"github.com/replicatedhq/embedded-cluster/pkg/helm"
2021
"github.com/stretchr/testify/assert"
2122
"github.com/stretchr/testify/require"
2223
"golang.org/x/crypto/bcrypt"
@@ -35,11 +36,12 @@ func TestAuthLoginAndTokenValidation(t *testing.T) {
3536
installation.WithNetUtils(&utils.MockNetUtils{}),
3637
)),
3738
linuxinstall.WithReleaseData(integration.DefaultReleaseData()),
39+
linuxinstall.WithHelmClient(&helm.MockClient{}),
3840
)
3941
require.NoError(t, err)
4042

4143
// Create the API with the auth controller
42-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetLinux,
44+
apiInstance := integration.NewTargetLinuxAPIWithReleaseData(t, types.ModeInstall,
4345
api.WithAuthController(authController),
4446
api.WithLinuxInstallController(installController),
4547
api.WithLogger(logger.NewDiscardLogger()),
@@ -137,7 +139,7 @@ func TestAuthLoginAndTokenValidation(t *testing.T) {
137139

138140
func TestAPIClientLogin(t *testing.T) {
139141
// Create the API with the auth controller
140-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetLinux,
142+
apiInstance := integration.NewTargetLinuxAPIWithReleaseData(t, types.ModeInstall,
141143
api.WithLogger(logger.NewDiscardLogger()),
142144
)
143145

api/integration/console/controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestConsoleListAvailableNetworkInterfaces(t *testing.T) {
2929
require.NoError(t, err)
3030

3131
// Create the API with the install controller
32-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetLinux,
32+
apiInstance := integration.NewTargetLinuxAPIWithReleaseData(t, types.ModeInstall,
3333
api.WithConsoleController(consoleController),
3434
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
3535
api.WithLogger(logger.NewDiscardLogger()),
@@ -73,7 +73,7 @@ func TestConsoleListAvailableNetworkInterfacesUnauthorized(t *testing.T) {
7373
require.NoError(t, err)
7474

7575
// Create the API with the install controller
76-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetLinux,
76+
apiInstance := integration.NewTargetLinuxAPIWithReleaseData(t, types.ModeInstall,
7777
api.WithConsoleController(consoleController),
7878
api.WithAuthController(auth.NewStaticAuthController("VALID_TOKEN")),
7979
api.WithLogger(logger.NewDiscardLogger()),
@@ -113,7 +113,7 @@ func TestConsoleListAvailableNetworkInterfacesError(t *testing.T) {
113113
require.NoError(t, err)
114114

115115
// Create the API with the install controller
116-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetLinux,
116+
apiInstance := integration.NewTargetLinuxAPIWithReleaseData(t, types.ModeInstall,
117117
api.WithConsoleController(consoleController),
118118
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
119119
api.WithLogger(logger.NewDiscardLogger()),

api/integration/kubernetes/install/appconfig_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func TestInstallController_PatchAppConfigValuesWithAPIClient(t *testing.T) {
7171
require.NoError(t, err)
7272

7373
// Create the API with the install controller
74-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetKubernetes,
74+
apiInstance := integration.NewTargetKubernetesAPIWithReleaseData(t, types.ModeInstall,
7575
api.WithKubernetesInstallController(installController),
7676
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
7777
api.WithLogger(logger.NewDiscardLogger()),
@@ -123,7 +123,7 @@ func TestInstallController_PatchAppConfigValuesWithAPIClient(t *testing.T) {
123123
require.NoError(t, err)
124124

125125
// Create the API with the completed install controller
126-
completedAPIInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetKubernetes,
126+
completedAPIInstance := integration.NewTargetKubernetesAPIWithReleaseData(t, types.ModeInstall,
127127
api.WithKubernetesInstallController(completedInstallController),
128128
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
129129
api.WithLogger(logger.NewDiscardLogger()),
@@ -227,7 +227,7 @@ func TestInstallController_GetAppConfigValuesWithAPIClient(t *testing.T) {
227227
require.NoError(t, err)
228228

229229
// Create the API with the install controller
230-
apiInstance := integration.NewAPIWithReleaseData(t, types.ModeInstall, types.InstallTargetKubernetes,
230+
apiInstance := integration.NewTargetKubernetesAPIWithReleaseData(t, types.ModeInstall,
231231
api.WithKubernetesInstallController(installController),
232232
api.WithAuthController(auth.NewStaticAuthController("TOKEN")),
233233
api.WithLogger(logger.NewDiscardLogger()),

0 commit comments

Comments
 (0)