Skip to content

Commit d721ddc

Browse files
committed
test: add regression test for key_prefix ending with a digit
Adds a plan-time validation test asserting that a key_prefix ending in a digit (e.g. PTFY25) is rejected before any API call is made. Addresses review comment from @austenstone.
1 parent cfee7c5 commit d721ddc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

github/resource_github_repository_autolink_reference_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,24 @@ func TestAccGithubRepositoryAutolinkReference(t *testing.T) {
296296
},
297297
})
298298
})
299+
300+
t.Run("rejects key_prefix ending with a digit at plan time", func(t *testing.T) {
301+
config := `
302+
resource "github_repository_autolink_reference" "autolink_invalid" {
303+
repository = "some-repo"
304+
key_prefix = "PTFY25"
305+
target_url_template = "https://example.com/<num>"
306+
}
307+
`
308+
309+
resource.UnitTest(t, resource.TestCase{
310+
ProviderFactories: providerFactories,
311+
Steps: []resource.TestStep{
312+
{
313+
Config: config,
314+
ExpectError: regexp.MustCompile(`must not end with a number`),
315+
},
316+
},
317+
})
318+
})
299319
}

0 commit comments

Comments
 (0)