Skip to content

Commit

Permalink
Fix broken test case
Browse files Browse the repository at this point in the history
```
~>  make testacc TESTARGS='-run=PackerChannel'
==> Checking that code complies with gofmt requirements...
golangci-lint run --config ./golangci-config.yml
TF_ACC=1 go test ./internal/... -v -run=PackerChannel -timeout 210m -parallel=10
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/clients	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/consul	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/input	(cached) [no tests to run]
=== RUN   TestAccPackerChannel
--- PASS: TestAccPackerChannel (12.96s)
=== RUN   TestAccPackerChannel_AssignedIteration
--- PASS: TestAccPackerChannel_AssignedIteration (14.68s)
=== RUN   TestAccPackerChannel_UpdateAssignedIteration
--- PASS: TestAccPackerChannel_UpdateAssignedIteration (24.46s)
=== RUN   TestAccPackerChannel_UpdateAssignedIterationWithFingerprint
--- PASS: TestAccPackerChannel_UpdateAssignedIterationWithFingerprint (10.79s)
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider	63.765s
```
  • Loading branch information
nywilken committed Jan 27, 2023
1 parent ee3504a commit f066cc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
var (
acctestAlpineBucket = fmt.Sprintf("alpine-acc-%s", time.Now().Format("200601021504"))
acctestUbuntuBucket = fmt.Sprintf("ubuntu-acc-%s", time.Now().Format("200601021504"))
acctestProductionChannel = "production"
acctestProductionChannel = fmt.Sprintf("packer-acc-channel-%s", time.Now().Format("200601021504"))
)

var (
Expand Down
19 changes: 8 additions & 11 deletions internal/provider/resource_packer_channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func TestAccPackerChannel(t *testing.T) {

func TestAccPackerChannel_AssignedIteration(t *testing.T) {
resourceName := "hcp_packer_channel.production"
acctestChannelName := "assinged"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t, map[string]bool{"aws": false, "azure": false}) },
Expand All @@ -78,7 +77,7 @@ func TestAccPackerChannel_AssignedIteration(t *testing.T) {
}
upsertBuild(t, acctestAlpineBucket, fingerprint, itID)
},
Config: testConfig(testAccPackerChannelAssignedLatestIteration(acctestAlpineBucket, acctestChannelName)),
Config: testConfig(testAccPackerChannelAssignedLatestIteration(acctestAlpineBucket, acctestProductionChannel)),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "author_id"),
resource.TestCheckResourceAttr(resourceName, "bucket_name", acctestAlpineBucket),
Expand Down Expand Up @@ -114,7 +113,6 @@ func TestAccPackerChannel_AssignedIteration(t *testing.T) {

func TestAccPackerChannel_UpdateAssignedIteration(t *testing.T) {
resourceName := "hcp_packer_channel.production"
acctestChannelName := "update-test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t, map[string]bool{"aws": false, "azure": false}) },
Expand All @@ -135,13 +133,13 @@ func TestAccPackerChannel_UpdateAssignedIteration(t *testing.T) {
}
upsertBuild(t, acctestAlpineBucket, fingerprint, itID)
},
Config: testConfig(testAccPackerChannelAssignedLatestIteration(acctestAlpineBucket, acctestChannelName)),
Config: testConfig(testAccPackerChannelAssignedLatestIteration(acctestAlpineBucket, acctestProductionChannel)),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "author_id"),
resource.TestCheckResourceAttrSet(resourceName, "created_at"),
resource.TestCheckResourceAttrSet(resourceName, "id"),
resource.TestCheckResourceAttr(resourceName, "bucket_name", acctestAlpineBucket),
resource.TestCheckResourceAttr(resourceName, "name", acctestChannelName),
resource.TestCheckResourceAttr(resourceName, "name", acctestProductionChannel),
resource.TestCheckResourceAttrSet(resourceName, "iteration_assignment.0.id"),
),
},
Expand All @@ -155,7 +153,7 @@ func TestAccPackerChannel_UpdateAssignedIteration(t *testing.T) {
}
upsertBuild(t, acctestAlpineBucket, fingerprint, itID)
},
Config: testConfig(testAccPackerChannelAssignedLatestIteration(acctestAlpineBucket, acctestChannelName)),
Config: testConfig(testAccPackerChannelAssignedLatestIteration(acctestAlpineBucket, acctestProductionChannel)),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "author_id"),
resource.TestCheckResourceAttr(resourceName, "bucket_name", acctestAlpineBucket),
Expand All @@ -165,7 +163,7 @@ func TestAccPackerChannel_UpdateAssignedIteration(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceName, "iteration.0.id"),
resource.TestCheckResourceAttrSet(resourceName, "iteration.0.incremental_version"),
resource.TestCheckResourceAttr(resourceName, "iteration.0.fingerprint", "channel-update-it2"),
resource.TestCheckResourceAttr(resourceName, "name", acctestChannelName),
resource.TestCheckResourceAttr(resourceName, "name", acctestProductionChannel),
resource.TestCheckResourceAttrSet(resourceName, "updated_at"),
),
},
Expand All @@ -174,8 +172,7 @@ func TestAccPackerChannel_UpdateAssignedIteration(t *testing.T) {
}

func TestAccPackerChannel_UpdateAssignedIterationWithFingerprint(t *testing.T) {
resourceName := "hcp_packer_channel.staging"
acctestChannelName := "fingerprint-test"
resourceName := "hcp_packer_channel.production"

fingerprint := "channel-update-it1"
resource.Test(t, resource.TestCase{
Expand All @@ -196,7 +193,7 @@ func TestAccPackerChannel_UpdateAssignedIterationWithFingerprint(t *testing.T) {
}
upsertBuild(t, acctestAlpineBucket, fingerprint, itID)
},
Config: testConfig(testAccPackerChannelIterationFingerprint(acctestAlpineBucket, acctestChannelName, fingerprint)),
Config: testConfig(testAccPackerChannelIterationFingerprint(acctestAlpineBucket, acctestProductionChannel, fingerprint)),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "author_id"),
resource.TestCheckResourceAttr(resourceName, "bucket_name", acctestAlpineBucket),
Expand All @@ -206,7 +203,7 @@ func TestAccPackerChannel_UpdateAssignedIterationWithFingerprint(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceName, "iteration.0.id"),
resource.TestCheckResourceAttrSet(resourceName, "iteration.0.incremental_version"),
resource.TestCheckResourceAttr(resourceName, "iteration.0.fingerprint", fingerprint),
resource.TestCheckResourceAttr(resourceName, "name", acctestChannelName),
resource.TestCheckResourceAttr(resourceName, "name", acctestProductionChannel),
resource.TestCheckResourceAttrSet(resourceName, "updated_at"),
),
},
Expand Down

0 comments on commit f066cc1

Please sign in to comment.