-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch 241111 example e2e test pipeline (#665)
* add e2e test case for examples * update make terrafmt command to format examples * update nightly test pipeline * fix the test
- Loading branch information
Showing
10 changed files
with
64 additions
and
111 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
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
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
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 |
---|---|---|
|
@@ -94,9 +94,9 @@ e.g. to replace a resource when either the SKU or os_type attributes change: | |
|
||
```hcl | ||
resource "azapi_data_plane_resource" "example" { | ||
name = var.name | ||
type = "Microsoft.AppConfiguration/configurationStores/[email protected]" | ||
body = { | ||
name = var.name | ||
type = "Microsoft.AppConfiguration/configurationStores/[email protected]" | ||
body = { | ||
properties = { | ||
sku = var.sku | ||
zones = var.zones | ||
|
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
101 changes: 0 additions & 101 deletions
101
...pPlatform_Spring_buildServices_builders_buildpackBindings@2023-05-01-preview copy/main.tf
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -176,9 +176,9 @@ func (r *DataPlaneResource) Schema(ctx context.Context, request resource.SchemaR | |
"\n" + | ||
"```hcl\n" + | ||
"resource \"azapi_data_plane_resource\" \"example\" {\n" + | ||
" name = var.name\n" + | ||
" type = \"Microsoft.AppConfiguration/configurationStores/[email protected]\"\n" + | ||
" body = {\n" + | ||
" name = var.name\n" + | ||
" type = \"Microsoft.AppConfiguration/configurationStores/[email protected]\"\n" + | ||
" body = {\n" + | ||
" properties = {\n" + | ||
" sku = var.sku\n" + | ||
" zones = var.zones\n" + | ||
|
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
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,50 @@ | ||
package services_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/Azure/terraform-provider-azapi/internal/acceptance" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccExamples(t *testing.T) { | ||
cases := strings.Split(os.Getenv("ARM_TEST_EXAMPLES"), ",") | ||
|
||
for _, c := range cases { | ||
if strings.Trim(c, " ") == "" { | ||
continue | ||
} | ||
t.Run(c, func(t *testing.T) { | ||
workingDir := path.Join("..", "..", "examples", c) | ||
t.Logf("Running example %s", workingDir) | ||
|
||
content, err := os.ReadFile(path.Join(workingDir, "main.tf")) | ||
if err != nil { | ||
t.Errorf("Error reading main.tf: %v", err) | ||
return | ||
} | ||
|
||
data := acceptance.BuildTestData(t, "azapi_resource", "test") | ||
config := string(content) | ||
config = strings.ReplaceAll(config, `terraform { | ||
required_providers { | ||
azapi = { | ||
source = "Azure/azapi" | ||
} | ||
} | ||
}`, "") | ||
config = strings.ReplaceAll(config, `default = "acctest0001"`, fmt.Sprintf(`default = "acctest%s"`, data.RandomString)) | ||
|
||
r := GenericResource{} | ||
data.ResourceTest(t, r, []resource.TestStep{ | ||
{ | ||
Config: config, | ||
}, | ||
}) | ||
}) | ||
} | ||
} |
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