-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Enable azure agentless test (#671)
* Fix: Enable azure agentless test Signed-off-by: Lei Jin <[email protected]> * fix: Fix the azure agentless example Signed-off-by: Lei Jin <[email protected]> --------- Signed-off-by: Lei Jin <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
41 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
76 changes: 38 additions & 38 deletions
76
integration/resource_lacework_integration_azure_agentless_scanning_test.go
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 |
---|---|---|
@@ -1,46 +1,46 @@ | ||
package integration | ||
|
||
//import ( | ||
// "fmt" | ||
// "testing" | ||
// | ||
// "github.com/gruntwork-io/terratest/modules/terraform" | ||
// "github.com/stretchr/testify/assert" | ||
//) | ||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TestIntegrationAzureAgentlessScanningCreate applies integration terraform: | ||
// => '../examples/resource_lacework_integration_azure_agentless_scanning' | ||
// | ||
// It uses the go-sdk to verify the created integration, | ||
// applies an update with new integration name and destroys it | ||
//func TestIntegrationAzureAgentlessScanningCreate(t *testing.T) { | ||
// credential, err := azureLoadDefaultCredentials() | ||
// integration_name := "Azure Agentless Scanning Example Integration Test" | ||
// update_integration_name := fmt.Sprintf("%s Updated", integration_name) | ||
// if assert.Nil(t, err, "this test requires you to set AZURE_CREDENTIALS environment variable") { | ||
// terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ | ||
// TerraformDir: "../examples/resource_lacework_integration_azure_agentless_scanning", | ||
// Vars: map[string]interface{}{ | ||
// "integration_name": integration_name, | ||
// "client_id": credential.ClientID, | ||
// "client_secret": credential.ClientSecret, | ||
// }, | ||
// EnvVars: map[string]string{ | ||
// "LW_API_TOKEN": LwApiToken, | ||
// }, | ||
// }) | ||
// defer terraform.Destroy(t, terraformOptions) | ||
// | ||
// // Create new Azure Agentless Scanning integration | ||
// create := terraform.InitAndApplyAndIdempotent(t, terraformOptions) | ||
// createData := GetAzureAgentlessScanningResponse(create) | ||
// assert.Equal(t, integration_name, createData.Data.Name) | ||
// | ||
// // Update Azure integration | ||
// terraformOptions.Vars["integration_name"] = update_integration_name | ||
// | ||
// update := terraform.InitAndApplyAndIdempotent(t, terraformOptions) | ||
// updateData := GetAzureAgentlessScanningResponse(update) | ||
// assert.Equal(t, update_integration_name, updateData.Data.Name) | ||
// } | ||
//} | ||
func TestIntegrationAzureAgentlessScanningCreate(t *testing.T) { | ||
credential, err := azureLoadDefaultCredentials() | ||
integration_name := "Azure Agentless Scanning Example Integration Test" | ||
update_integration_name := fmt.Sprintf("%s Updated", integration_name) | ||
if assert.Nil(t, err, "this test requires you to set AZURE_CREDENTIALS environment variable") { | ||
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ | ||
TerraformDir: "../examples/resource_lacework_integration_azure_agentless_scanning", | ||
Vars: map[string]interface{}{ | ||
"integration_name": integration_name, | ||
"client_id": credential.ClientID, | ||
"client_secret": credential.ClientSecret, | ||
}, | ||
EnvVars: map[string]string{ | ||
"LW_API_TOKEN": LwApiToken, | ||
}, | ||
}) | ||
defer terraform.Destroy(t, terraformOptions) | ||
|
||
// Create new Azure Agentless Scanning integration | ||
create := terraform.InitAndApplyAndIdempotent(t, terraformOptions) | ||
createData := GetAzureAgentlessScanningResponse(create) | ||
assert.Equal(t, integration_name, createData.Data.Name) | ||
|
||
// Update Azure integration | ||
terraformOptions.Vars["integration_name"] = update_integration_name | ||
|
||
update := terraform.InitAndApplyAndIdempotent(t, terraformOptions) | ||
updateData := GetAzureAgentlessScanningResponse(update) | ||
assert.Equal(t, update_integration_name, updateData.Data.Name) | ||
} | ||
} |