Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
See: rubrikinc/terraform-provider-polaris#85

* Added unit tests for Azure service principal
* Added unit tests for listing Azure tenants and subscriptions
* Replace the old way of listing tenants/subscriptions with single API
call.
* Added Tenant/Tenants/TenantFromAppID
* Added app name to ServicePrincipal
  • Loading branch information
johan3141592 committed Apr 3, 2024
1 parent 783f717 commit 5361964
Show file tree
Hide file tree
Showing 26 changed files with 885 additions and 375 deletions.
2 changes: 1 addition & 1 deletion examples/azure_subscription/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
func main() {
ctx := context.Background()

// Load configuration and create client.
// Load configuration and create the client.
polAccount, err := polaris.DefaultServiceAccount(true)
if err != nil {
log.Fatal(err)
Expand Down
17 changes: 10 additions & 7 deletions internal/testsetup/testsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// testAwsAccount hold AWS account information used in the integration tests.
// Normally used to assert that the information read from Polaris is correct.
// Normally used to assert that the information read from RSC is correct.
type testAwsAccount struct {
Profile string `json:"profile"`
AccountID string `json:"accountId"`
Expand Down Expand Up @@ -49,19 +49,22 @@ func AWSAccount() (testAwsAccount, error) {

// testAzureSubscription hold Azure subscription information used in the
// integration tests. Normally used to assert that the information read from
// Polaris is correct.
// RSC is correct.
type testAzureSubscription struct {
SubscriptionID uuid.UUID `json:"subscriptionId"`
SubscriptionName string `json:"subscriptionName"`
TenantID uuid.UUID `json:"tenantId"`
TenantDomain string `json:"tenantDomain"`
PrincipalID uuid.UUID `json:"principalId"`
PrincipalName string `json:"principalName"`
PrincipalSecret string `json:"principalSecret"`

Exocompute struct {
SubnetID string `json:"subnetId"`
} `json:"exocompute"`

// should be in EastUS2 region
// for integration test
// as region is hardcoded there.
// Should be in EastUS2 region for integration test as the region is
// hardcoded there.
Archival struct {
ManagedIdentityName string `json:"managedIdentityName"`
PrincipalID string `json:"managedIdentityPrincipalId"`
Expand All @@ -86,7 +89,7 @@ func AzureSubscription() (testAzureSubscription, error) {
}

// testGcpProject hold GCP project information used in the integration tests.
// Normally used to assert that the information read from Polaris is correct.
// Normally used to assert that the information read from RSC is correct.
type testGcpProject struct {
ProjectName string `json:"projectName"`
ProjectID string `json:"projectId"`
Expand All @@ -109,7 +112,7 @@ func GCPProject() (testGcpProject, error) {
}

// testRSCConfig hold configuration information used in the integration tests.
// Normally used to assert that the information read from Polaris is correct.
// Normally used to assert that the information read from RSC is correct.
type testRSCConfig struct {
ExistingUserEmail string `json:"existingUserEmail"`
NewUserEmail string `json:"newUserEmail"`
Expand Down
Loading

0 comments on commit 5361964

Please sign in to comment.