Skip to content

Commit

Permalink
fix: change _Stable tests to _UpgradeProvider
Browse files Browse the repository at this point in the history
These tests were no longer useful. Update the 2 _Stables tests to be
_UpgradeProvider tests instead. Most other resources and data sources
already have them.

Change the version of the terraform provider to upgrade from to be
0.12.0 which is the last release. 0.10.1 is showing a panic which has
already been addressed.
  • Loading branch information
hmlanigan committed Jul 9, 2024
1 parent f18350a commit f6b41f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
20 changes: 13 additions & 7 deletions internal/provider/data_source_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,33 @@ func TestAcc_DataSourceMachine_Edge(t *testing.T) {
})
}

func TestAcc_DataSourceMachine_Stable(t *testing.T) {
func TestAcc_DataSourceMachine_UpgradeProvider(t *testing.T) {
if testingCloud != LXDCloudTesting {
t.Skip(t.Name() + " only runs with LXD")
}
modelName := acctest.RandomWithPrefix("tf-datasource-machine-test-model")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: map[string]resource.ExternalProvider{
"juju": {
VersionConstraint: TestProviderStableVersion,
Source: "juju/juju",
},
},

Steps: []resource.TestStep{
{
ExternalProviders: map[string]resource.ExternalProvider{
"juju": {
VersionConstraint: TestProviderStableVersion,
Source: "juju/juju",
},
},
Config: testAccDataSourceMachine(modelName, "series = \"jammy\""),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.juju_machine.machine", "model", modelName),
),
},
{
ProtoV6ProviderFactories: frameworkProviderFactories,
Config: testAccDataSourceMachine(modelName, "series = \"jammy\""),
PlanOnly: true,
},
},
})
}
Expand Down
20 changes: 13 additions & 7 deletions internal/provider/data_source_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,31 @@ func TestAcc_DataSourceModel_Edge(t *testing.T) {
})
}

func TestAcc_DataSourceModel_Stable(t *testing.T) {
func TestAcc_DataSourceModel_UpgradeProvider(t *testing.T) {
modelName := acctest.RandomWithPrefix("tf-datasource-model-test")

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: map[string]resource.ExternalProvider{
"juju": {
VersionConstraint: TestProviderStableVersion,
Source: "juju/juju",
},
},

Steps: []resource.TestStep{
{
ExternalProviders: map[string]resource.ExternalProvider{
"juju": {
VersionConstraint: TestProviderStableVersion,
Source: "juju/juju",
},
},
Config: testAccFrameworkDataSourceModel(modelName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.juju_model.test-model", "name", modelName),
resource.TestCheckResourceAttrSet("data.juju_model.test-model", "uuid"),
),
},
{
ProtoV6ProviderFactories: frameworkProviderFactories,
Config: testAccFrameworkDataSourceModel(modelName),
PlanOnly: true,
},
},
})
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/juju/terraform-provider-juju/internal/juju"
)

const TestProviderStableVersion = "0.10.1"
const TestProviderStableVersion = "0.12.0"

// providerFactories are used to instantiate the Framework provider during
// acceptance testing.
Expand Down

0 comments on commit f6b41f4

Please sign in to comment.