-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
pkg/framework/objects/azure_dev_ops_project/data_source_acceptance_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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package azure_dev_ops_project_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/acctest_helper" | ||
"github.com/hashicorp/terraform-plugin-testing/config" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccDbtCloudAzureDevOpsProject(t *testing.T) { | ||
if acctest_helper.IsDbtCloudPR() { | ||
t.Skip("Skipping Azure DevOps Project datasource test in CI until a Personal Access Token is available") | ||
} | ||
|
||
adoProjectName := "dbt-cloud-ado-project" | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest_helper.TestAccPreCheck(t) }, | ||
|
||
ProtoV6ProviderFactories: acctest_helper.TestAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
ConfigVariables: config.Variables{ | ||
"dbt_token": config.StringVariable("this-will-come-from-somewhere-else-eventually"), // Cannot be a Service Token | ||
"ado_project_name": config.StringVariable(adoProjectName), | ||
}, | ||
Config: ` | ||
variable "dbt_token" { | ||
type = string | ||
sensitive = true | ||
} | ||
provider "dbtcloud" { | ||
token = var.dbt_token | ||
} | ||
variable "ado_project_name" { | ||
type = string | ||
} | ||
data dbtcloud_azure_dev_ops_project test { | ||
name = var.ado_project_name | ||
} | ||
`, | ||
// we check the computed values, for the other ones the test suite already checks that the plan and state are the same | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet( | ||
"data.dbtcloud_azure_dev_ops_project.test", | ||
"id", | ||
), | ||
resource.TestCheckResourceAttrSet( | ||
"data.dbtcloud_azure_dev_ops_project.test", | ||
"url", | ||
), | ||
), | ||
}, | ||
}, | ||
}) | ||
|
||
} |