Skip to content

Commit

Permalink
fix: machine types in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk committed Aug 26, 2024
1 parent 309fd35 commit 6be11ad
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
22 changes: 11 additions & 11 deletions get/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ func TestMySQL(t *testing.T) {
},
{
name: "single",
instances: map[string]storage.MySQLParameters{"test": {MachineType: infra.MachineType("nine-standard-1")}},
wantContain: []string{"nine-standard-1"},
instances: map[string]storage.MySQLParameters{"test": {MachineType: infra.MachineType("nine-db-prod-s")}},
wantContain: []string{"nine-db-prod-s"},
},
{
name: "multiple",
instances: map[string]storage.MySQLParameters{
"test1": {MachineType: infra.MachineType("nine-standard-1")},
"test2": {MachineType: infra.MachineType("nine-standard-2")},
"test3": {MachineType: infra.MachineType("nine-standard-4")},
"test1": {MachineType: infra.MachineType("nine-db-prod-s")},
"test2": {MachineType: infra.MachineType("nine-db-prod-m")},
"test3": {MachineType: infra.MachineType("nine-db-prod-l")},
},
wantContain: []string{"nine-standard-1", "nine-standard-2", "test3"},
wantContain: []string{"nine-db-prod-s", "nine-db-prod-m", "test3"},
},
{
name: "get-by-name",
instances: map[string]storage.MySQLParameters{
"test1": {MachineType: infra.MachineType("nine-standard-1")},
"test2": {MachineType: infra.MachineType("nine-standard-2")},
"test1": {MachineType: infra.MachineType("nine-db-prod-s")},
"test2": {MachineType: infra.MachineType("nine-db-prod-m")},
},
get: mySQLCmd{resourceCmd: resourceCmd{Name: "test1"}},
wantContain: []string{"test1", "nine-standard-1"},
wantContain: []string{"test1", "nine-db-prod-s"},
},
{
name: "show-password",
instances: map[string]storage.MySQLParameters{
"test1": {MachineType: infra.MachineType("nine-standard-1")},
"test2": {MachineType: infra.MachineType("nine-standard-2")},
"test1": {MachineType: infra.MachineType("nine-db-prod-s")},
"test2": {MachineType: infra.MachineType("nine-db-prod-m")},
},
get: mySQLCmd{resourceCmd: resourceCmd{Name: "test2"}, PrintPassword: true},
wantContain: []string{"test2-topsecret"},
Expand Down
22 changes: 11 additions & 11 deletions get/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ func TestPostgres(t *testing.T) {
},
{
name: "single",
instances: map[string]storage.PostgresParameters{"test": {MachineType: infra.MachineType("nine-standard-1")}},
wantContain: []string{"nine-standard-1"},
instances: map[string]storage.PostgresParameters{"test": {MachineType: infra.MachineType("nine-db-prod-s")}},
wantContain: []string{"nine-db-prod-s"},
},
{
name: "multiple",
instances: map[string]storage.PostgresParameters{
"test1": {MachineType: infra.MachineType("nine-standard-1")},
"test2": {MachineType: infra.MachineType("nine-standard-2")},
"test3": {MachineType: infra.MachineType("nine-standard-4")},
"test1": {MachineType: infra.MachineType("nine-db-prod-s")},
"test2": {MachineType: infra.MachineType("nine-db-prod-m")},
"test3": {MachineType: infra.MachineType("nine-db-prod-l")},
},
wantContain: []string{"nine-standard-1", "nine-standard-2", "test3"},
wantContain: []string{"nine-db-prod-s", "nine-db-prod-m", "test3"},
},
{
name: "get-by-name",
instances: map[string]storage.PostgresParameters{
"test1": {MachineType: infra.MachineType("nine-standard-1")},
"test2": {MachineType: infra.MachineType("nine-standard-2")},
"test1": {MachineType: infra.MachineType("nine-db-prod-s")},
"test2": {MachineType: infra.MachineType("nine-db-prod-m")},
},
get: postgresCmd{resourceCmd: resourceCmd{Name: "test1"}},
wantContain: []string{"test1", "nine-standard-1"},
wantContain: []string{"test1", "nine-db-prod-s"},
},
{
name: "show-password",
instances: map[string]storage.PostgresParameters{
"test1": {MachineType: infra.MachineType("nine-standard-1")},
"test2": {MachineType: infra.MachineType("nine-standard-2")},
"test1": {MachineType: infra.MachineType("nine-db-prod-s")},
"test2": {MachineType: infra.MachineType("nine-db-prod-m")},
},
get: postgresCmd{resourceCmd: resourceCmd{Name: "test2"}, PrintPassword: true},
wantContain: []string{"test2-topsecret"},
Expand Down
14 changes: 7 additions & 7 deletions update/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ func TestMySQL(t *testing.T) {
},
{
name: "increase-machineType",
update: mySQLCmd{MachineType: ptr.To(infra.MachineType("nine-standard-1"))},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-standard-1")},
update: mySQLCmd{MachineType: ptr.To(infra.MachineType("nine-db-prod-s"))},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-db-prod-s")},
},
{
name: "decrease-machineType",
create: storage.MySQLParameters{MachineType: infra.MachineType("nine-standard-2")},
update: mySQLCmd{MachineType: ptr.To(infra.MachineType("nine-standard-1"))},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-standard-1")},
create: storage.MySQLParameters{MachineType: infra.MachineType("nine-db-prod-m")},
update: mySQLCmd{MachineType: ptr.To(infra.MachineType("nine-db-prod-s"))},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-db-prod-s")},
},
{
name: "sqlMode-no-mode-set-initially",
Expand Down Expand Up @@ -91,8 +91,8 @@ func TestMySQL(t *testing.T) {
{
name: "multi-update",
create: storage.MySQLParameters{AllowedCIDRs: []meta.IPv4CIDR{"0.0.0.0/0"}},
update: mySQLCmd{MachineType: ptr.To(infra.MachineType("nine-standard-1"))},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-standard-1"), AllowedCIDRs: []meta.IPv4CIDR{meta.IPv4CIDR("0.0.0.0/0")}},
update: mySQLCmd{MachineType: ptr.To(infra.MachineType("nine-db-prod-s"))},
want: storage.MySQLParameters{MachineType: infra.MachineType("nine-db-prod-s"), AllowedCIDRs: []meta.IPv4CIDR{meta.IPv4CIDR("0.0.0.0/0")}},
},
}
for _, tt := range tests {
Expand Down
14 changes: 7 additions & 7 deletions update/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ func TestPostgres(t *testing.T) {
},
{
name: "increase-machineType",
update: postgresCmd{MachineType: ptr.To(infra.MachineType("nine-standard-1"))},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-standard-1")},
update: postgresCmd{MachineType: ptr.To(infra.MachineType("nine-db-prod-s"))},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-db-prod-s")},
},
{
name: "decrease-machineType",
create: storage.PostgresParameters{MachineType: infra.MachineType("nine-standard-2")},
update: postgresCmd{MachineType: ptr.To(infra.MachineType("nine-standard-1"))},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-standard-1")},
create: storage.PostgresParameters{MachineType: infra.MachineType("nine-db-prod-m")},
update: postgresCmd{MachineType: ptr.To(infra.MachineType("nine-db-prod-s"))},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-db-prod-s")},
},
{
name: "sshKeys",
Expand All @@ -60,8 +60,8 @@ func TestPostgres(t *testing.T) {
{
name: "multi-update",
create: storage.PostgresParameters{AllowedCIDRs: []meta.IPv4CIDR{"0.0.0.0/0"}},
update: postgresCmd{MachineType: ptr.To(infra.MachineType("nine-standard-1"))},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-standard-1"), AllowedCIDRs: []meta.IPv4CIDR{meta.IPv4CIDR("0.0.0.0/0")}},
update: postgresCmd{MachineType: ptr.To(infra.MachineType("nine-db-prod-s"))},
want: storage.PostgresParameters{MachineType: infra.MachineType("nine-db-prod-s"), AllowedCIDRs: []meta.IPv4CIDR{meta.IPv4CIDR("0.0.0.0/0")}},
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 6be11ad

Please sign in to comment.