Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.

Commit 1ff6e14

Browse files
author
Ryan SVIHLA
committed
error text from astra is displayed again, terminate will wait on failed terminates
1 parent aae1080 commit 1ff6e14

File tree

9 files changed

+81
-162
lines changed

9 files changed

+81
-162
lines changed

cmd/db/create.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,15 @@ import (
2626

2727
var createDbName string
2828
var createDbKeyspace string
29-
var createDbUser string
30-
var createDbPassword string
3129
var createDbRegion string
3230
var createDbTier string
33-
var createDbCapacityUnit int
3431
var createDbCloudProvider string
3532

3633
func init() {
3734
CreateCmd.Flags().StringVarP(&createDbName, "name", "n", "", "name to give to the Astra Database")
3835
CreateCmd.Flags().StringVarP(&createDbKeyspace, "keyspace", "k", "", "keyspace user to give to the Astra Database")
39-
CreateCmd.Flags().StringVarP(&createDbUser, "user", "u", "", "user password to give to the Astra Database")
40-
CreateCmd.Flags().StringVarP(&createDbPassword, "password", "p", "", "db password to give to the Astra Database")
4136
CreateCmd.Flags().StringVarP(&createDbRegion, "region", "r", "us-east1", "region to give to the Astra Database")
4237
CreateCmd.Flags().StringVarP(&createDbTier, "tier", "t", "serverless", "tier to give to the Astra Database")
43-
CreateCmd.Flags().IntVarP(&createDbCapacityUnit, "capacityUnit", "c", 1, "capacityUnit flag to give to the Astra Database")
4438
CreateCmd.Flags().StringVarP(&createDbCloudProvider, "cloudProvider", "l", "GCP", "cloud provider flag to give to the Astra Database")
4539
}
4640

@@ -67,10 +61,8 @@ func executeCreate(makeClient func() (pkg.Client, error)) error {
6761
createDb := astraops.DatabaseInfoCreate{
6862
Name: createDbName,
6963
Keyspace: createDbKeyspace,
70-
CapacityUnits: createDbCapacityUnit,
64+
CapacityUnits: 1, // we only support 1 CU on initial creation as of Feb 14 2022
7165
Region: createDbRegion,
72-
User: &createDbUser,
73-
Password: &createDbPassword,
7466
Tier: astraops.Tier(createDbTier),
7567
CloudProvider: astraops.CloudProvider(createDbCloudProvider),
7668
}

cmd/db/create_test.go

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,6 @@ func TestCreateSetsKeyspace(t *testing.T) {
111111
}
112112
}
113113

114-
func TestCreateSetsCapacityUnit(t *testing.T) {
115-
mockClient := &tests.MockClient{}
116-
createDbCapacityUnit = 10000
117-
err := executeCreate(func() (pkg.Client, error) {
118-
return mockClient, nil
119-
})
120-
if err != nil {
121-
t.Fatalf("unexpected error '%v'", err)
122-
}
123-
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate)
124-
if arg0.CapacityUnits != createDbCapacityUnit {
125-
t.Errorf("expected '%v' but was '%v'", arg0.CapacityUnits, createDbCapacityUnit)
126-
}
127-
}
128-
129114
func TestCreateSetsRegion(t *testing.T) {
130115
mockClient := &tests.MockClient{}
131116
createDbRegion = "EU-West1"
@@ -141,39 +126,6 @@ func TestCreateSetsRegion(t *testing.T) {
141126
}
142127
}
143128

144-
func TestCreateSetsUser(t *testing.T) {
145-
mockClient := &tests.MockClient{}
146-
// sets createDbUser on the package variable in cmd/db/create.go
147-
createDbUser = "john@james.com"
148-
err := executeCreate(func() (pkg.Client, error) {
149-
return mockClient, nil
150-
})
151-
if err != nil {
152-
t.Fatalf("unexpected error '%v'", err)
153-
}
154-
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate)
155-
if arg0.User != &createDbUser {
156-
user := *arg0.User
157-
t.Errorf("expected '%v' but was '%v'", user, createDbUser)
158-
}
159-
}
160-
161-
func TestCreateSetsPass(t *testing.T) {
162-
mockClient := &tests.MockClient{}
163-
// sets createDbPassword on the package variable in cmd/db/create.go
164-
createDbPassword = "afdfdf"
165-
err := executeCreate(func() (pkg.Client, error) {
166-
return mockClient, nil
167-
})
168-
if err != nil {
169-
t.Fatalf("unexpected error '%v'", err)
170-
}
171-
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate)
172-
if arg0.Password != &createDbPassword {
173-
t.Errorf("expected '%v' but was '%v'", *arg0.Password, createDbPassword)
174-
}
175-
}
176-
177129
func TestCreateSetsTier(t *testing.T) {
178130
mockClient := &tests.MockClient{}
179131
createDbTier = "afdfdf"

cmd/db/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func executeList(login func() (pkg.Client, error)) (string, error) {
6464
return "", fmt.Errorf("unable to login with error '%v'", err)
6565
}
6666
var dbs []astraops.Database
67-
if dbs, err = client.ListDb(include, provider, startingAfter, int32(limit)); err != nil {
67+
if dbs, err = client.ListDb(include, provider, startingAfter, limit); err != nil {
6868
return "", fmt.Errorf("unable to get list of dbs with error '%v'", err)
6969
}
7070
switch listFmt {

cmd/db/resize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func executeResize(args []string, makeClient func() (pkg.Client, error)) error {
6060
Err: fmt.Errorf("unable to parse capacity unit '%s' with error %v", capacityUnitRaw, err),
6161
}
6262
}
63-
if err := client.Resize(id, int32(capacityUnit)); err != nil {
63+
if err := client.Resize(id, int(capacityUnit)); err != nil {
6464
return fmt.Errorf("unable to resize '%s' with error %v", id, err)
6565
}
6666
fmt.Printf("resize database %v submitted with size %v\n", id, capacityUnit)

cmd/db/resize_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func TestResize(t *testing.T) {
4242
if id != actualID {
4343
t.Errorf("expected '%v' but was '%v'", id, actualID)
4444
}
45-
actualSize := mockClient.Call(0).([]interface{})[1].(int32)
46-
if int32(100) != actualSize {
45+
actualSize := mockClient.Call(0).([]interface{})[1].(int)
46+
if 100 != actualSize {
4747
t.Errorf("expected '%v' but was '%v'", size, actualSize)
4848
}
4949
}

0 commit comments

Comments
 (0)