Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tests #600

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions spacelift/resource_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestContextResource(t *testing.T) {
t.Run("creates and updates contexts without an error", func(t *testing.T) {
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

config := func(description string) string {
config := func(name, description string) string {
return fmt.Sprintf(`
resource "spacelift_context" "test" {
name = "Provider test context %s"
Expand All @@ -34,16 +34,16 @@ func TestContextResource(t *testing.T) {
before_perform = ["before_perform"]
before_plan = ["before_plan"]
}
`, randomID, description)
`, name+randomID, description)
}

testSteps(t, []resource.TestStep{
{
Config: config("old description"),
Config: config("foo", "old description"),
Check: Resource(
resourceName,
Attribute("id", Equals("provider-test-context-old-description")),
Attribute("name", Equals("Provider test context old description")),
Attribute("id", StartsWith("provider-test-context-foo")),
Attribute("name", StartsWith("Provider test context foo")),
Attribute("description", Equals("old description")),
SetEquals("labels", "one", "two"),
Attribute("after_apply.#", Equals("1")),
Expand Down Expand Up @@ -76,11 +76,11 @@ func TestContextResource(t *testing.T) {
ImportStateVerify: true,
},
{
Config: config("new description"),
Config: config("bar", "new description"),
Check: Resource(
resourceName,
Attribute("id", Equals("provider-test-context-old-description")), // ID shouldn't change on rename
Attribute("name", Equals("Provider test context new description")), // but the name should
Attribute("id", StartsWith("provider-test-context-foo")), // ID shouldn't change on rename
Attribute("name", StartsWith("Provider test context bar")), // but the name should
Attribute("description", Equals("new description")),
),
},
Expand Down
Loading