Skip to content

Commit

Permalink
SUP-2536: Asserting pipeline template datasource attributes on its te…
Browse files Browse the repository at this point in the history
…sts (#559)

* Asserting pipeline template datasource attributes on tests

* [skip ci] Changelog amended with PR

* PR title, lets get a status check
  • Loading branch information
james2791 authored Aug 28, 2024
1 parent a3f0b37 commit 84b51a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- SUP-2536: Asserting pipeline template datasource attributes on its tests [[PR #559](https://github.com/buildkite/terraform-provider-buildkite/pull/559)] @james2791

## [v1.10.2](https://github.com/buildkite/terraform-provider-buildkite/compare/v1.10.1...v1.10.2)

- Adding a feature request template for better issue management/submission [[PR #549](https://github.com/buildkite/terraform-provider-buildkite/pull/549)] @mcncl
Expand Down
24 changes: 12 additions & 12 deletions buildkite/data_source_pipeline_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAccBuildkitePipelineTemplateDatasource(t *testing.T) {
configuration = "steps:\n - label: \":pipeline:\"\n command: \"buildkite-agent pipeline upload\""
}
data "buildkite_pipeline_template" "data_template_foo" {
data "buildkite_pipeline_template" "template_foo" {
depends_on = [buildkite_pipeline_template.template_foo]
id = buildkite_pipeline_template.template_foo.id
}
Expand All @@ -50,7 +50,7 @@ func TestAccBuildkitePipelineTemplateDatasource(t *testing.T) {
configuration = "steps:\n - label: \":pipeline:\"\n command: \"buildkite-agent pipeline upload\""
}
data "buildkite_pipeline_template" "data_template_bar" {
data "buildkite_pipeline_template" "template_bar" {
depends_on = [buildkite_pipeline_template.template_bar]
name = "Template %s"
}
Expand All @@ -73,7 +73,7 @@ func TestAccBuildkitePipelineTemplateDatasource(t *testing.T) {
configuration = "steps:\n - label: \":pipeline:\"\n command: \"buildkite-agent pipeline upload\""
}
data "buildkite_pipeline_template" "data_template_bar" {
data "buildkite_pipeline_template" "template_bar" {
depends_on = [buildkite_pipeline_template.template_bar]
name = "Template %s"
}
Expand All @@ -96,7 +96,7 @@ func TestAccBuildkitePipelineTemplateDatasource(t *testing.T) {
configuration = "steps:\n - label: \":pipeline:\"\n command: \"buildkite-agent pipeline upload\""
}
data "buildkite_pipeline_template" "data_template_bar" {
data "buildkite_pipeline_template" "template_bar" {
depends_on = [buildkite_pipeline_template.template_bar]
id = buildkite_pipeline_template.template_bar.id
name = "Template %s"
Expand All @@ -114,10 +114,10 @@ func TestAccBuildkitePipelineTemplateDatasource(t *testing.T) {
// Confirm the pipeline template has the correct values in Buildkite's system
testAccCheckPipelineTemplateRemoteValues(&ptr, fmt.Sprintf("Template %s", randName), false),
// Check all pipeline template resource attributes are set in state (required attributes)
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_foo", "id"),
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_foo", "uuid"),
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_foo", "name"),
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_foo", "configuration"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_foo", "id"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_foo", "uuid"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_foo", "name"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_foo", "configuration"),
)

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -143,10 +143,10 @@ func TestAccBuildkitePipelineTemplateDatasource(t *testing.T) {
// Confirm the pipeline template has the correct values in Buildkite's system
testAccCheckPipelineTemplateRemoteValues(&ptr, fmt.Sprintf("Template %s", randName), false),
// Check all pipeline template resource attributes are set in state (required attributes)
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_bar", "id"),
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_bar", "uuid"),
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_bar", "name"),
resource.TestCheckResourceAttrSet("buildkite_pipeline_template.template_bar", "configuration"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_bar", "id"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_bar", "uuid"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_bar", "name"),
resource.TestCheckResourceAttrSet("data.buildkite_pipeline_template.template_bar", "configuration"),
)

resource.ParallelTest(t, resource.TestCase{
Expand Down

0 comments on commit 84b51a3

Please sign in to comment.