-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed deprecated go devops api * new framework using swagger API https://github.com/datastax/astra-client-go/
- Loading branch information
Ryan SVIHLA
authored
Jan 10, 2022
1 parent
402fa7a
commit 601bcac
Showing
20 changed files
with
805 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,8 @@ bin/ | |
.DS_Store | ||
|
||
dist/ | ||
|
||
.vagrant | ||
|
||
*.swp | ||
Vagrantfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,9 @@ import ( | |
"fmt" | ||
"testing" | ||
|
||
astraops "github.com/datastax/astra-client-go/v2/astra" | ||
"github.com/rsds143/astra-cli/pkg" | ||
tests "github.com/rsds143/astra-cli/pkg/tests" | ||
"github.com/rsds143/astra-devops-sdk-go/astraops" | ||
) | ||
|
||
func TestCreateGetsId(t *testing.T) { | ||
|
@@ -30,7 +30,7 @@ func TestCreateGetsId(t *testing.T) { | |
mockClient := &tests.MockClient{ | ||
Databases: []astraops.Database{ | ||
{ | ||
ID: expectedID, | ||
Id: expectedID, | ||
}, | ||
}, | ||
} | ||
|
@@ -90,7 +90,7 @@ func TestCreateSetsName(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.Name != createDbName { | ||
t.Errorf("expected '%v' but was '%v'", arg0.Name, createDbName) | ||
} | ||
|
@@ -105,7 +105,7 @@ func TestCreateSetsKeyspace(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.Keyspace != createDbKeyspace { | ||
t.Errorf("expected '%v' but was '%v'", arg0.Keyspace, createDbKeyspace) | ||
} | ||
|
@@ -120,8 +120,8 @@ func TestCreateSetsCapacityUnit(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
if arg0.CapacityUnits != int32(createDbCapacityUnit) { | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.CapacityUnits != createDbCapacityUnit { | ||
t.Errorf("expected '%v' but was '%v'", arg0.CapacityUnits, createDbCapacityUnit) | ||
} | ||
} | ||
|
@@ -135,39 +135,42 @@ func TestCreateSetsRegion(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.Region != createDbRegion { | ||
t.Errorf("expected '%v' but was '%v'", arg0.Region, createDbRegion) | ||
} | ||
} | ||
|
||
func TestCreateSetsUser(t *testing.T) { | ||
mockClient := &tests.MockClient{} | ||
// sets createDbUser on the package variable in cmd/db/create.go | ||
createDbUser = "[email protected]" | ||
err := executeCreate(func() (pkg.Client, error) { | ||
return mockClient, nil | ||
}) | ||
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
if arg0.User != createDbUser { | ||
t.Errorf("expected '%v' but was '%v'", arg0.User, createDbUser) | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.User != &createDbUser { | ||
user := *arg0.User | ||
t.Errorf("expected '%v' but was '%v'", user, createDbUser) | ||
} | ||
} | ||
|
||
func TestCreateSetsPass(t *testing.T) { | ||
mockClient := &tests.MockClient{} | ||
createDbUser = "afdfdf" | ||
// sets createDbPassword on the package variable in cmd/db/create.go | ||
createDbPassword = "afdfdf" | ||
err := executeCreate(func() (pkg.Client, error) { | ||
return mockClient, nil | ||
}) | ||
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
if arg0.Password != createDbPassword { | ||
t.Errorf("expected '%v' but was '%v'", arg0.Password, createDbPassword) | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.Password != &createDbPassword { | ||
t.Errorf("expected '%v' but was '%v'", *arg0.Password, createDbPassword) | ||
} | ||
} | ||
|
||
|
@@ -180,8 +183,8 @@ func TestCreateSetsTier(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
if arg0.Tier != createDbTier { | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.Tier != astraops.Tier(createDbTier) { | ||
t.Errorf("expected '%v' but was '%v'", arg0.Tier, createDbTier) | ||
} | ||
} | ||
|
@@ -195,8 +198,8 @@ func TestCreateSetsProvider(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("unexpected error '%v'", err) | ||
} | ||
arg0 := mockClient.Call(0).(astraops.CreateDb) | ||
if arg0.CloudProvider != createDbCloudProvider { | ||
arg0 := mockClient.Call(0).(astraops.DatabaseInfoCreate) | ||
if arg0.CloudProvider != astraops.CloudProvider(createDbCloudProvider) { | ||
t.Errorf("expected '%v' but was '%v'", arg0.CloudProvider, createDbCloudProvider) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.