Skip to content

Commit 69cd904

Browse files
committed
f
1 parent d14364c commit 69cd904

File tree

14 files changed

+56
-62
lines changed

14 files changed

+56
-62
lines changed

api/controllers/kubernetes/install/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ func (c *InstallController) GetAppConfigValues(ctx context.Context, maskPassword
7676
return nil, fmt.Errorf("get app config: %w", err)
7777
}
7878

79-
return c.appConfigManager.GetConfigValues(ctx, appConfig, maskPasswords)
79+
return c.appConfigManager.GetConfigValues(appConfig, maskPasswords)
8080
}

api/controllers/kubernetes/install/app_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/stretchr/testify/require"
1717
)
1818

19-
func TestInstallController_SetAppConfigValues(t *testing.T) {
19+
func TestInstallController_PatchAppConfigValues(t *testing.T) {
2020
// Create an app config for testing
2121
appConfig := kotsv1beta1.Config{
2222
Spec: kotsv1beta1.ConfigSpec{
@@ -169,7 +169,7 @@ func TestInstallController_SetAppConfigValues(t *testing.T) {
169169
)
170170
require.NoError(t, err)
171171

172-
err = controller.SetAppConfigValues(t.Context(), tt.values)
172+
err = controller.PatchAppConfigValues(t.Context(), tt.values)
173173

174174
if tt.expectedErr {
175175
assert.Error(t, err)
@@ -244,7 +244,7 @@ func TestInstallController_GetAppConfigValues(t *testing.T) {
244244
)
245245
require.NoError(t, err)
246246

247-
values, err := controller.GetAppConfigValues(t.Context())
247+
values, err := controller.GetAppConfigValues(t.Context(), false)
248248

249249
if tt.expectedErr {
250250
assert.Error(t, err)

api/controllers/kubernetes/install/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
210210
if err != nil {
211211
return nil, fmt.Errorf("validate app config values: %w", err)
212212
}
213-
err = controller.appConfigManager.SetConfigValues(*controller.releaseData.AppConfig, controller.configValues)
213+
err = controller.appConfigManager.PatchConfigValues(*controller.releaseData.AppConfig, controller.configValues)
214214
if err != nil {
215215
return nil, fmt.Errorf("set app config values: %w", err)
216216
}

api/controllers/kubernetes/install/infra.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (c *InstallController) SetupInfra(ctx context.Context) (finalErr error) {
2828
}
2929
}()
3030

31-
configValues, err := c.appConfigManager.GetKotsadmConfigValues(ctx, *c.releaseData.AppConfig)
31+
configValues, err := c.appConfigManager.GetKotsadmConfigValues(*c.releaseData.AppConfig)
3232
if err != nil {
3333
return fmt.Errorf("failed to get kotsadm config values: %w", err)
3434
}

api/controllers/linux/install/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ func (c *InstallController) GetAppConfigValues(ctx context.Context, maskPassword
7676
return nil, fmt.Errorf("get app config: %w", err)
7777
}
7878

79-
return c.appConfigManager.GetConfigValues(ctx, appConfig, maskPasswords)
79+
return c.appConfigManager.GetConfigValues(appConfig, maskPasswords)
8080
}

api/controllers/linux/install/app_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/stretchr/testify/require"
1717
)
1818

19-
func TestInstallController_SetAppConfigValues(t *testing.T) {
19+
func TestInstallController_PatchAppConfigValues(t *testing.T) {
2020
// Create an app config for testing
2121
appConfig := kotsv1beta1.Config{
2222
Spec: kotsv1beta1.ConfigSpec{
@@ -169,7 +169,7 @@ func TestInstallController_SetAppConfigValues(t *testing.T) {
169169
)
170170
require.NoError(t, err)
171171

172-
err = controller.SetAppConfigValues(t.Context(), tt.values)
172+
err = controller.PatchAppConfigValues(t.Context(), tt.values)
173173

174174
if tt.expectedErr {
175175
assert.Error(t, err)
@@ -244,7 +244,7 @@ func TestInstallController_GetAppConfigValues(t *testing.T) {
244244
)
245245
require.NoError(t, err)
246246

247-
values, err := controller.GetAppConfigValues(t.Context())
247+
values, err := controller.GetAppConfigValues(t.Context(), false)
248248

249249
if tt.expectedErr {
250250
assert.Error(t, err)

api/controllers/linux/install/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func NewInstallController(opts ...InstallControllerOption) (*InstallController,
264264
if err != nil {
265265
return nil, fmt.Errorf("validate app config values: %w", err)
266266
}
267-
err = controller.appConfigManager.SetConfigValues(*controller.releaseData.AppConfig, controller.configValues)
267+
err = controller.appConfigManager.PatchConfigValues(*controller.releaseData.AppConfig, controller.configValues)
268268
if err != nil {
269269
return nil, fmt.Errorf("set app config values: %w", err)
270270
}

api/controllers/linux/install/infra.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (c *InstallController) SetupInfra(ctx context.Context, ignoreHostPreflights
4343
}
4444
}
4545

46-
configValues, err := c.appConfigManager.GetKotsadmConfigValues(ctx, *c.releaseData.AppConfig)
46+
configValues, err := c.appConfigManager.GetKotsadmConfigValues(*c.releaseData.AppConfig)
4747
if err != nil {
4848
return fmt.Errorf("failed to get kotsadm config values: %w", err)
4949
}

api/integration/kubernetes/install/app_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func TestKubernetesPatchAppConfigValues(t *testing.T) {
352352
apiInstance.RegisterRoutes(router)
353353

354354
// Create a request to set config values without the required item
355-
setRequest := types.SetAppConfigValuesRequest{
355+
setRequest := types.PatchAppConfigValuesRequest{
356356
Values: map[string]string{
357357
"test-item": "new-value",
358358
// required-item is intentionally omitted
@@ -363,7 +363,7 @@ func TestKubernetesPatchAppConfigValues(t *testing.T) {
363363
require.NoError(t, err)
364364

365365
// Create a request
366-
req := httptest.NewRequest(http.MethodPost, "/kubernetes/install/app/config/values", bytes.NewReader(reqBodyBytes))
366+
req := httptest.NewRequest(http.MethodPatch, "/kubernetes/install/app/config/values", bytes.NewReader(reqBodyBytes))
367367
req.Header.Set("Content-Type", "application/json")
368368
req.Header.Set("Authorization", "Bearer "+"TOKEN")
369369
rec := httptest.NewRecorder()
@@ -544,34 +544,34 @@ func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
544544
// Create client with the predefined token
545545
c := apiclient.New(server.URL, apiclient.WithToken("TOKEN"))
546546

547-
// Test SetKubernetesAppConfigValues
548-
t.Run("SetKubernetesAppConfigValues", func(t *testing.T) {
547+
// Test PatchKubernetesAppConfigValues
548+
t.Run("PatchKubernetesAppConfigValues", func(t *testing.T) {
549549
// Create config values to set
550550
configValues := map[string]string{
551551
"test-item": "new-value",
552552
"required-item": "required-value",
553553
}
554554

555555
// Set the app config values using the client
556-
config, err := c.SetKubernetesAppConfigValues(configValues)
557-
require.NoError(t, err, "SetKubernetesAppConfigValues should succeed")
556+
config, err := c.PatchKubernetesAppConfigValues(configValues)
557+
require.NoError(t, err, "PatchKubernetesAppConfigValues should succeed")
558558

559559
// Verify the raw app config is returned (not the applied values)
560560
assert.Equal(t, "value", config.Groups[0].Items[0].Value.String(), "first item should return raw config schema value")
561561
assert.Equal(t, "", config.Groups[0].Items[1].Value.String(), "second item should return empty value since it has no default")
562562
})
563563

564-
// Test SetKubernetesAppConfigValues with missing required item
565-
t.Run("SetKubernetesAppConfigValues missing required", func(t *testing.T) {
564+
// Test PatchKubernetesAppConfigValues with missing required item
565+
t.Run("PatchKubernetesAppConfigValues missing required", func(t *testing.T) {
566566
// Create config values without the required item
567567
configValues := map[string]string{
568568
"test-item": "new-value",
569569
// required-item is intentionally omitted
570570
}
571571

572572
// Set the app config values using the client
573-
_, err := c.SetKubernetesAppConfigValues(configValues)
574-
require.Error(t, err, "SetKubernetesAppConfigValues should fail with missing required item")
573+
_, err := c.PatchKubernetesAppConfigValues(configValues)
574+
require.Error(t, err, "PatchKubernetesAppConfigValues should fail with missing required item")
575575

576576
// Check that the error is of correct type
577577
apiErr, ok := err.(*types.APIError)
@@ -582,8 +582,8 @@ func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
582582
assert.Equal(t, "item is required", apiErr.Errors[0].Message, "Error should indicate item is required")
583583
})
584584

585-
// Test SetKubernetesAppConfigValues with invalid state transition
586-
t.Run("SetKubernetesAppConfigValues invalid state", func(t *testing.T) {
585+
// Test PatchKubernetesAppConfigValues with invalid state transition
586+
t.Run("PatchKubernetesAppConfigValues invalid state", func(t *testing.T) {
587587
// Create an install controller in a completed state
588588
completedInstallController, err := kubernetesinstall.NewInstallController(
589589
kubernetesinstall.WithStateMachine(kubernetesinstall.NewStateMachine(kubernetesinstall.WithCurrentState(kubernetesinstall.StateSucceeded))),
@@ -622,8 +622,8 @@ func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
622622
}
623623

624624
// Set the app config values using the client
625-
_, err = completedClient.SetKubernetesAppConfigValues(configValues)
626-
require.Error(t, err, "SetKubernetesAppConfigValues should fail with invalid state transition")
625+
_, err = completedClient.PatchKubernetesAppConfigValues(configValues)
626+
require.Error(t, err, "PatchKubernetesAppConfigValues should fail with invalid state transition")
627627

628628
// Check that the error is of correct type
629629
apiErr, ok := err.(*types.APIError)

api/integration/linux/install/app_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func TestLinuxPatchAppConfigValues(t *testing.T) {
354354
apiInstance.RegisterRoutes(router)
355355

356356
// Create a request to set config values without the required item
357-
setRequest := types.SetAppConfigValuesRequest{
357+
setRequest := types.PatchAppConfigValuesRequest{
358358
Values: map[string]string{
359359
"test-item": "new-value",
360360
// required-item is intentionally omitted
@@ -365,7 +365,7 @@ func TestLinuxPatchAppConfigValues(t *testing.T) {
365365
require.NoError(t, err)
366366

367367
// Create a request
368-
req := httptest.NewRequest(http.MethodPost, "/linux/install/app/config/values", bytes.NewReader(reqBodyBytes))
368+
req := httptest.NewRequest(http.MethodPatch, "/linux/install/app/config/values", bytes.NewReader(reqBodyBytes))
369369
req.Header.Set("Content-Type", "application/json")
370370
req.Header.Set("Authorization", "Bearer "+"TOKEN")
371371
rec := httptest.NewRecorder()
@@ -546,34 +546,34 @@ func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
546546
// Create client with the predefined token
547547
c := apiclient.New(server.URL, apiclient.WithToken("TOKEN"))
548548

549-
// Test SetLinuxAppConfigValues
550-
t.Run("SetLinuxAppConfigValues", func(t *testing.T) {
549+
// Test PatchLinuxAppConfigValues
550+
t.Run("PatchLinuxAppConfigValues", func(t *testing.T) {
551551
// Create config values to set
552552
configValues := map[string]string{
553553
"test-item": "new-value",
554554
"required-item": "required-value",
555555
}
556556

557557
// Set the app config values using the client
558-
config, err := c.SetLinuxAppConfigValues(configValues)
559-
require.NoError(t, err, "SetLinuxAppConfigValues should succeed")
558+
config, err := c.PatchLinuxAppConfigValues(configValues)
559+
require.NoError(t, err, "PatchLinuxAppConfigValues should succeed")
560560

561561
// Verify the raw app config is returned (not the applied values)
562562
assert.Equal(t, "value", config.Groups[0].Items[0].Value.String(), "first item should return raw config schema value")
563563
assert.Equal(t, "", config.Groups[0].Items[1].Value.String(), "second item should return empty value since it has no default")
564564
})
565565

566-
// Test SetLinuxAppConfigValues with missing required item
567-
t.Run("SetLinuxAppConfigValues missing required", func(t *testing.T) {
566+
// Test PatchLinuxAppConfigValues with missing required item
567+
t.Run("PatchLinuxAppConfigValues missing required", func(t *testing.T) {
568568
// Create config values without the required item
569569
configValues := map[string]string{
570570
"test-item": "new-value",
571571
// required-item is intentionally omitted
572572
}
573573

574574
// Set the app config values using the client
575-
_, err := c.SetLinuxAppConfigValues(configValues)
576-
require.Error(t, err, "SetLinuxAppConfigValues should fail with missing required item")
575+
_, err := c.PatchLinuxAppConfigValues(configValues)
576+
require.Error(t, err, "PatchLinuxAppConfigValues should fail with missing required item")
577577

578578
// Check that the error is of correct type
579579
apiErr, ok := err.(*types.APIError)
@@ -584,8 +584,8 @@ func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
584584
assert.Equal(t, "item is required", apiErr.Errors[0].Message, "Error should indicate item is required")
585585
})
586586

587-
// Test SetLinuxAppConfigValues with invalid state transition
588-
t.Run("SetLinuxAppConfigValues invalid state", func(t *testing.T) {
587+
// Test PatchLinuxAppConfigValues with invalid state transition
588+
t.Run("PatchLinuxAppConfigValues invalid state", func(t *testing.T) {
589589
// Create an install controller in a completed state
590590
completedInstallController, err := linuxinstall.NewInstallController(
591591
linuxinstall.WithStateMachine(linuxinstall.NewStateMachine(linuxinstall.WithCurrentState(linuxinstall.StateSucceeded))),
@@ -624,8 +624,8 @@ func TestInstallController_SetAppConfigValuesWithAPIClient(t *testing.T) {
624624
}
625625

626626
// Set the app config values using the client
627-
_, err = completedClient.SetLinuxAppConfigValues(configValues)
628-
require.Error(t, err, "SetLinuxAppConfigValues should fail with invalid state transition")
627+
_, err = completedClient.PatchLinuxAppConfigValues(configValues)
628+
require.Error(t, err, "PatchLinuxAppConfigValues should fail with invalid state transition")
629629

630630
// Check that the error is of correct type
631631
apiErr, ok := err.(*types.APIError)

0 commit comments

Comments
 (0)