Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PengyuanZhao committed Dec 5, 2024
1 parent ad2f6bb commit 02fc45b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lwgenerate/azure/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func TestGenerationAzureRmProviderWithSubscriptionID(t *testing.T) {
func TestGenerationEntraIDActivityLog(t *testing.T) {
ActivityLogEntraID, fileErr := getFileContent("test-data/entra-id-activity-log-no-custom-input.tf")
assert.Nil(t, fileErr)
hcl, err := azure.NewTerraform(false, false, true, true).Generate()
hcl, err := azure.NewTerraform(false, false, true, true, azure.WithSubscriptionID("test-subscription")).Generate()
assert.Nil(t, err)
assert.NotNil(t, hcl)
assert.Equal(t, ActivityLogEntraID, hcl)
Expand All @@ -302,7 +302,12 @@ func TestGenerationEntraIDActivityLog(t *testing.T) {
func TestGenerationEntraIDActivityLogExistingActiveDirectoryApp(t *testing.T) {
ActivityLogEntraID, fileErr := getFileContent("test-data/entra-id-activity-log-existing-ad-app.tf")
assert.Nil(t, fileErr)
hcl, err := azure.NewTerraform(false, false, true, false, azure.WithAdApplicationId("testID"), azure.WithAdApplicationPassword("pass"), azure.WithAdServicePrincipalId("principal")).Generate()
hcl, err := azure.NewTerraform(false, false, true, false,
azure.WithSubscriptionID("test-subscription"),
azure.WithAdApplicationId("testID"),
azure.WithAdApplicationPassword("pass"),
azure.WithAdServicePrincipalId("principal"),
).Generate()
assert.Nil(t, err)
assert.NotNil(t, hcl)
assert.Equal(t, ActivityLogEntraID, hcl)
Expand All @@ -311,7 +316,11 @@ func TestGenerationEntraIDActivityLogExistingActiveDirectoryApp(t *testing.T) {
func TestGenerationEntraIDActivityLogEventHubLocationAndPartition(t *testing.T) {
ActivityLogEntraID, fileErr := getFileContent("test-data/entra-id-activity-log-event-hub-location-and-partition.tf")
assert.Nil(t, fileErr)
hcl, err := azure.NewTerraform(false, false, true, true, azure.WithEventHubLocation("West US 2"), azure.WithEventHubPartitionCount(2)).Generate()
hcl, err := azure.NewTerraform(false, false, true, true,
azure.WithSubscriptionID("test-subscription"),
azure.WithEventHubLocation("West US 2"),
azure.WithEventHubPartitionCount(2),
).Generate()
assert.Nil(t, err)
assert.NotNil(t, hcl)
assert.Equal(t, ActivityLogEntraID, hcl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provider "azuread" {
}

provider "azurerm" {
subscription_id = "test-subscription"
features {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provider "azuread" {
}

provider "azurerm" {
subscription_id = "test-subscription"
features {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ provider "azuread" {
}

provider "azurerm" {
subscription_id = "test-subscription"
features {
}
}
Expand Down

0 comments on commit 02fc45b

Please sign in to comment.