-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
99 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
package common | ||
package common_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/databricks/terraform-provider-databricks/internal/providers/pluginfw/common" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetDatabricksStagingName(t *testing.T) { | ||
resourceName := "test" | ||
expected := "databricks_test_pluginframework" | ||
result := GetDatabricksStagingName(resourceName) | ||
result := common.GetDatabricksStagingName(resourceName) | ||
assert.Equal(t, expected, result, "GetDatabricksStagingName should return the expected staging name") | ||
} | ||
|
||
func TestGetDatabricksProductionName(t *testing.T) { | ||
resourceName := "test" | ||
expected := "databricks_test" | ||
result := GetDatabricksProductionName(resourceName) | ||
result := common.GetDatabricksProductionName(resourceName) | ||
assert.Equal(t, expected, result, "GetDatabricksProductionName should return the expected production name") | ||
} |
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,17 @@ | ||
package common | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/diag" | ||
) | ||
|
||
// DiagToString converts a slice of diag.Diagnostics to a string. | ||
func DiagToString(d diag.Diagnostics) string { | ||
b := strings.Builder{} | ||
for _, diag := range d { | ||
b.WriteString(fmt.Sprintf("[%s] %s: %s\n", diag.Severity(), diag.Summary(), diag.Detail())) | ||
} | ||
return b.String() | ||
} |
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