Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-8019 Support partial updates of settings and other entities #2705

Merged
merged 24 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
518b682
PMM-8019 Get rid of enable/disable flags in settings
artemgavrilov Dec 18, 2023
602448c
PMM-8019 Fixes
artemgavrilov Dec 18, 2023
841eb7a
Merge remote-tracking branch 'origin/v3-api-breaking-changes' into PM…
artemgavrilov Dec 18, 2023
3ce9f8b
PMM-8019 Fix
artemgavrilov Dec 18, 2023
4234ac2
PMM-8019 Cleanup
artemgavrilov Dec 18, 2023
802bd1f
PMM-8019 Fix tests
artemgavrilov Dec 18, 2023
14ea1c1
PMM-8019 Fixes
artemgavrilov Dec 18, 2023
501dad5
Merge remote-tracking branch 'origin/v3-api-breaking-changes' into PM…
artemgavrilov Dec 19, 2023
24d8a4b
PMM-8019 Fix migrations order
artemgavrilov Dec 19, 2023
90aa7af
PMM-8019 Fix DB migrations
artemgavrilov Dec 19, 2023
5979646
PMM-8019 Fix tests
artemgavrilov Dec 20, 2023
da584df
PMM-8019 Update docs
artemgavrilov Dec 20, 2023
f9f4cb4
PMM-8019 Fix
artemgavrilov Dec 21, 2023
3db6aa0
PMM-8019 Make check enabling toogle optional
artemgavrilov Dec 21, 2023
85a8382
PMM-8019 Make role update params optional
artemgavrilov Dec 21, 2023
543abbf
Merge remote-tracking branch 'origin/v3-api-breaking-changes' into PM…
artemgavrilov Dec 25, 2023
ea305e6
PMM-8019 Fix API tests
artemgavrilov Dec 26, 2023
01b45c9
PMM-8019 Use optional fields for tour flags
artemgavrilov Dec 26, 2023
028a8bb
PMM-8019 Use optionals instead of wrappers in API where it's possible
artemgavrilov Dec 26, 2023
5192034
PMM-8019 Comments
artemgavrilov Dec 26, 2023
ff8cc4f
PMM-8019 Fix tests
artemgavrilov Dec 26, 2023
5cce687
Merge remote-tracking branch 'origin/v3-api-breaking-changes' into PM…
artemgavrilov Dec 26, 2023
87cb62e
PMM-8019 Fix linters
artemgavrilov Dec 26, 2023
ca6219a
PMM-8019 Fix
artemgavrilov Dec 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ linters:
enable-all: true
disable:
# keep the rules sorted alpahbetically
- deadcode # unmaintained, we leverage `unused`
- dupl # we can't avoid duplicating code
- execinquery # false positives only
- exhaustivestruct # too annoying
- exhaustruct # too many files to fix/nolint
- deadcode # unmaintained, we leverage `unused`
- dupl # we can't avoid duplicating code
- funlen # useless
- gochecknoglobals # mostly useless
- gochecknoinits # we use init functions
Expand All @@ -100,6 +100,7 @@ linters:
- maligned # deprecated
- nlreturn # too annoying
- nosnakecase # deprecated
- protogetter # we need direct access to proto fields
- rowserrcheck # disabled because of generics
- scopelint # too many false positives
- structcheck # replaced by unused
Expand Down
6 changes: 3 additions & 3 deletions agent/agents/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ func TestCacheErrors(t *testing.T) {
t.Parallel()
var err error
_, err = New(100, time.Second*100, 100, logrus.WithField("test", t.Name()))
assert.NotNil(t, err)
assert.Error(t, err) //nolint:testifylint

_, err = New([]float64{}, time.Second*100, 100, logrus.WithField("test", t.Name()))
assert.NotNil(t, err)
assert.Error(t, err) //nolint:testifylint

_, err = New(struct{}{}, time.Second*100, 100, logrus.WithField("test", t.Name()))
assert.NotNil(t, err)
assert.Error(t, err) //nolint:testifylint
})

t.Run("WrongTypeOnRefresh", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions agent/utils/mongo_fix/mongo_fix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func TestClientOptionsForDSN(t *testing.T) {
assert.Equal(t, err.Error(), tt.error)
} else {
assert.Empty(t, err)
assert.Equal(t, got.Auth.Username, tt.expectedUser)
assert.Equal(t, got.Auth.Password, tt.expectedPassword)
assert.Equal(t, tt.expectedUser, got.Auth.Username)
assert.Equal(t, tt.expectedPassword, got.Auth.Password)
}
})
}
Expand Down
3 changes: 1 addition & 2 deletions api-tests/management/alerting/alerting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ import (
)

// Note: Even though the Alerting service checks for alerting enabled or disabled before returning results
// we don't enable or disable Alerting explicit in our tests since it is enabled by default through
// DISABLE_ALERTING env var.
// we don't enable or disable Alerting explicit in our tests since it is enabled by default.
func TestRulesAPI(t *testing.T) {
t.Parallel()
client := alertingClient.Default.AlertingService
Expand Down
8 changes: 4 additions & 4 deletions api-tests/management/backup/backups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ func TestScheduleBackup(t *testing.T) {

body := backups.ChangeScheduledBackupBody{
ScheduledBackupID: backupRes.Payload.ScheduledBackupID,
Enabled: true,
CronExpression: "0 2 2 2 2",
Name: "test2",
Description: "test2",
Enabled: pointer.ToBool(true),
CronExpression: pointer.ToString("0 2 2 2 2"),
Name: pointer.ToString("test2"),
Description: pointer.ToString("test2"),
}
changeRes, err := client.ChangeScheduledBackup(&backups.ChangeScheduledBackupParams{
Body: body,
Expand Down
10 changes: 4 additions & 6 deletions api-tests/server/advisors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ func TestChangeSecurityChecks(t *testing.T) {
Body: security_checks.ChangeSecurityChecksBody{
Params: []*security_checks.ChangeSecurityChecksParamsBodyParamsItems0{
{
Name: check.Name,
Disable: !check.Disabled,
Enable: check.Disabled,
Name: check.Name,
Enable: pointer.ToBool(!check.Enabled),
},
},
},
Expand All @@ -156,7 +155,7 @@ func TestChangeSecurityChecks(t *testing.T) {

for _, c := range resp.Payload.Checks {
if c.Name == check.Name {
assert.Equal(t, !check.Disabled, c.Disabled)
assert.NotEqual(t, check.Enabled, c.Enabled)
break
}
}
Expand Down Expand Up @@ -248,8 +247,7 @@ func toggleAdvisorChecks(t *testing.T, enable bool) {

res, err := serverClient.Default.ServerService.ChangeSettings(&server_service.ChangeSettingsParams{
Body: server_service.ChangeSettingsBody{
EnableStt: enable,
DisableStt: !enable,
EnableStt: pointer.ToBool(enable),
},
Context: pmmapitests.Context,
})
Expand Down
10 changes: 6 additions & 4 deletions api-tests/server/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ func restoreSettingsDefaults(t *testing.T) {

res, err := serverClient.Default.ServerService.ChangeSettings(&server.ChangeSettingsParams{
Body: server.ChangeSettingsBody{
EnableStt: true,
EnableTelemetry: true,
EnableAlerting: true,
EnableStt: pointer.ToBool(true),
EnableTelemetry: pointer.ToBool(true),
EnableAlerting: pointer.ToBool(true),
MetricsResolutions: &server.ChangeSettingsParamsBodyMetricsResolutions{
Hr: "5s",
Mr: "10s",
Expand All @@ -49,7 +49,9 @@ func restoreSettingsDefaults(t *testing.T) {
RareInterval: "280800s",
},
DataRetention: "2592000s",
AWSPartitions: []string{"aws"},
AWSPartitions: &server.ChangeSettingsParamsBodyAWSPartitions{
Values: []string{"aws"},
},
},
Context: pmmapitests.Context,
})
Expand Down
3 changes: 2 additions & 1 deletion api-tests/server/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"
"testing"

"github.com/AlekSi/pointer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -56,7 +57,7 @@ func TestPlatform(t *testing.T) {
// Set the PMM address to localhost.
res, err := serverClient.ChangeSettings(&server.ChangeSettingsParams{
Body: server.ChangeSettingsBody{
PMMPublicAddress: "localhost",
PMMPublicAddress: pointer.ToString("localhost"),
},
Context: pmmapitests.Context,
})
Expand Down
Loading
Loading