Skip to content
This repository was archived by the owner on Aug 19, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ required = [

[[constraint]]
name = "github.com/percona/pmm"
branch = "PMM-2.0"
branch = "PMM-4949-management"
37 changes: 0 additions & 37 deletions management/rds_discovery_test.go

This file was deleted.

84 changes: 84 additions & 0 deletions management/rds_test.go
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"

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 (from goimports)

Suggested change
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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func TestRDSDiscovery is unused (from unused)

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

Choose a reason for hiding this comment

The 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 godox)

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

Choose a reason for hiding this comment

The 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 godox)

})
}

func TestAddRds(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func TestAddRds is unused (from unused)

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.

Loading