@@ -16,7 +16,7 @@ func TestContextResource(t *testing.T) {
1616 t .Run ("creates and updates contexts without an error" , func (t * testing.T ) {
1717 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
1818
19- config := func (description string ) string {
19+ config := func (name , description string ) string {
2020 return fmt .Sprintf (`
2121 resource "spacelift_context" "test" {
2222 name = "Provider test context %s"
@@ -34,16 +34,16 @@ func TestContextResource(t *testing.T) {
3434 before_perform = ["before_perform"]
3535 before_plan = ["before_plan"]
3636 }
37- ` , randomID , description )
37+ ` , name + randomID , description )
3838 }
3939
4040 testSteps (t , []resource.TestStep {
4141 {
42- Config : config ("old description" ),
42+ Config : config ("foo" , " old description" ),
4343 Check : Resource (
4444 resourceName ,
45- Attribute ("id" , Equals ("provider-test-context-old-description " )),
46- Attribute ("name" , Equals ("Provider test context old description " )),
45+ Attribute ("id" , StartsWith ("provider-test-context-foo " )),
46+ Attribute ("name" , StartsWith ("Provider test context foo " )),
4747 Attribute ("description" , Equals ("old description" )),
4848 SetEquals ("labels" , "one" , "two" ),
4949 Attribute ("after_apply.#" , Equals ("1" )),
@@ -76,11 +76,11 @@ func TestContextResource(t *testing.T) {
7676 ImportStateVerify : true ,
7777 },
7878 {
79- Config : config ("new description" ),
79+ Config : config ("bar" , " new description" ),
8080 Check : Resource (
8181 resourceName ,
82- Attribute ("id" , Equals ("provider-test-context-old-description " )), // ID shouldn't change on rename
83- Attribute ("name" , Equals ("Provider test context new description " )), // but the name should
82+ Attribute ("id" , StartsWith ("provider-test-context-foo " )), // ID shouldn't change on rename
83+ Attribute ("name" , StartsWith ("Provider test context bar " )), // but the name should
8484 Attribute ("description" , Equals ("new description" )),
8585 ),
8686 },
0 commit comments