-
Couldn't load subscription status.
- Fork 6
PMM-4949 RDS Management API. #67
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,4 @@ required = [ | |
|
|
||
| [[constraint]] | ||
| name = "github.com/percona/pmm" | ||
| branch = "PMM-2.0" | ||
| branch = "PMM-4949-management" | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| package management | ||
|
|
||
| import ( | ||
| "math/rand" | ||
| "os" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/AlekSi/pointer" | ||
| pmmapitests "github.com/Percona-Lab/pmm-api-tests" | ||
| "github.com/percona/pmm/api/managementpb/json/client" | ||
| "github.com/percona/pmm/api/managementpb/json/client/rds" | ||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestRDSDiscovery(t *testing.T) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. func |
||
| t.Run("Basic", func(t *testing.T) { | ||
| accessKey, secretKey := os.Getenv("AWS_ACCESS_KEY"), os.Getenv("AWS_SECRET_KEY") | ||
| if accessKey == "" || secretKey == "" { | ||
| // TODO remove skip once secrets are added | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. management/rds_test.go:21: Line contains TODO/BUG/FIXME: "TODO remove skip once secrets are added" (from |
||
| t.Skip("Environment variables AWS_ACCESS_KEY / AWS_SECRET_KEY are not defined, skipping test") | ||
| } | ||
|
|
||
| params := &rds.DiscoverRDSParams{ | ||
| Body: rds.DiscoverRDSBody{ | ||
| AWSAccessKey: accessKey, | ||
| AWSSecretKey: secretKey, | ||
| }, | ||
| Context: pmmapitests.Context, | ||
| } | ||
| discoverOK, err := client.Default.RDS.DiscoverRDS(params) | ||
| require.NoError(t, err) | ||
| require.NotNil(t, discoverOK.Payload) | ||
| assert.NotEmpty(t, discoverOK.Payload.RDSInstances) | ||
|
|
||
| // TODO Better tests: https://jira.percona.com/browse/PMM-4896 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. management/rds_test.go:37: Line contains TODO/BUG/FIXME: "TODO Better tests: https://jira.percona...." (from |
||
| }) | ||
| } | ||
|
|
||
| func TestAddRds(t *testing.T) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. func |
||
| rand.Seed(time.Now().UnixNano()) | ||
| t.Run("BasicAddRDS", func(t *testing.T) { | ||
| params := &rds.AddRDSParams{ | ||
| Body: rds.AddRDSBody{ | ||
| Region: "region", | ||
| Az: "az", | ||
| InstanceID: "d752f1a9-31c9-4b8c-bb2d-d26bc000001", | ||
| NodeModel: "some-model", | ||
| Address: "some.example.rds", | ||
| Port: 3306, | ||
| Engine: pointer.ToString("DISCOVER_RDS_MYSQL"), | ||
| NodeName: "some-node-name-000001", | ||
| ServiceName: "test-add-rds-service000001", | ||
| Environment: "some-env", | ||
| Cluster: "cluster-01", | ||
| ReplicationSet: "rs-01", | ||
| Username: "some-username", | ||
| Password: "some-password", | ||
| AWSAccessKey: "my-aws-access-key", | ||
| AWSSecretKey: "my-aws-secret-key", | ||
| RDSExporter: true, | ||
| QANMysqlPerfschema: true, | ||
| CustomLabels: map[string]string{}, | ||
| SkipConnectionCheck: true, | ||
| TLS: false, | ||
| TLSSkipVerify: false, | ||
| DisableQueryExamples: false, | ||
| TablestatsGroupTableLimit: 2000, | ||
| }, | ||
| Context: pmmapitests.Context, | ||
| } | ||
| addRDSOK, err := client.Default.RDS.AddRDS(params) | ||
| require.NoError(t, err) | ||
| require.NotNil(t, addRDSOK.Payload) | ||
|
|
||
| body := addRDSOK.Payload | ||
| pmmapitests.RemoveAgents(t, body.MysqldExporter.AgentID) | ||
| pmmapitests.RemoveAgents(t, body.QANMysqlPerfschema.AgentID) | ||
| pmmapitests.RemoveAgents(t, body.RDSExporter.AgentID) | ||
| pmmapitests.RemoveServices(t, body.Mysql.ServiceID) | ||
| pmmapitests.RemoveNodes(t, body.Mysql.NodeID) | ||
| }) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File is not
goimports-ed with -local github.com/Percona-Lab/pmm-api-tests (fromgoimports)