@@ -2,6 +2,7 @@ package applesilicon_test
22
33import (
44 "fmt"
5+ "os"
56 "testing"
67
78 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
@@ -15,77 +16,45 @@ import (
1516func TestAccRunner_BasicGithub (t * testing.T ) {
1617 tt := acctest .NewTestTools (t )
1718 defer tt .Cleanup ()
19+ t .Skip ("can not register this cassette for security issue" )
20+ var githubUrl = os .Getenv ("GITHUB_URL_AS" )
21+ var githubToken = os .Getenv ("GITHUB_TOKEN_AS" )
1822
1923 resource .ParallelTest (t , resource.TestCase {
2024 ProtoV6ProviderFactories : tt .ProviderFactories ,
2125 CheckDestroy : isRunnerDestroyed (tt ),
2226 Steps : []resource.TestStep {
2327 {
24- Config : `
28+ Config : fmt . Sprintf ( `
2529 resource "scaleway_apple_silicon_runner" "main" {
2630 name = "TestAccRunnerGithub"
2731 ci_provider = "github"
2832 url = "%s"
2933 token = "%s"
30- labels = ["ci", "macos"]
3134 }
32- ` ,
35+ ` , githubUrl , githubToken ),
3336 Check : resource .ComposeTestCheckFunc (
3437 isRunnerPresent (tt , "scaleway_apple_silicon_runner.main" ),
3538 resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "name" , "TestAccRunnerGithub" ),
36- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "provider" , "github" ),
37- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "url" , "https://github.com/my-org/repo" ),
38- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "labels.#" , "2" ),
39+ resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "ci_provider" , "github" ),
40+ resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "url" , githubUrl ),
3941
4042 // Computed
4143 resource .TestCheckResourceAttrSet ("scaleway_apple_silicon_runner.main" , "status" ),
4244 ),
4345 },
4446 {
45- Config : `
47+ Config : fmt . Sprintf ( `
4648 resource "scaleway_apple_silicon_runner" "main" {
4749 name = "TestAccRunnerGithubUpdated"
4850 ci_provider = "github"
4951 url = "%s"
5052 token = "%s"
51- labels = ["updated"]
5253 }
53- ` ,
54+ ` , githubUrl , githubToken ),
5455 Check : resource .ComposeTestCheckFunc (
5556 isRunnerPresent (tt , "scaleway_apple_silicon_runner.main" ),
5657 resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "name" , "TestAccRunnerGithubUpdated" ),
57- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "labels.#" , "1" ),
58- ),
59- },
60- },
61- })
62- }
63-
64- func TestAccRunner_BasicGitlab (t * testing.T ) {
65- tt := acctest .NewTestTools (t )
66- defer tt .Cleanup ()
67-
68- resource .ParallelTest (t , resource.TestCase {
69- ProtoV6ProviderFactories : tt .ProviderFactories ,
70- CheckDestroy : isRunnerDestroyed (tt ),
71- Steps : []resource.TestStep {
72- {
73- Config : `
74- resource "scaleway_apple_silicon_runner" "main" {
75- name = "TestAccRunnerGitlab"
76- ci_provider = "gitlab"
77- url = "https://gitlab.com"
78- token = "gitlab-token"
79- }
80- ` ,
81- Check : resource .ComposeTestCheckFunc (
82- isRunnerPresent (tt , "scaleway_apple_silicon_runner.main" ),
83- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "name" , "TestAccRunnerGitlab" ),
84- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "provider" , "gitlab" ),
85- resource .TestCheckResourceAttr ("scaleway_apple_silicon_runner.main" , "url" , "https://gitlab.com" ),
86-
87- // Computed
88- resource .TestCheckResourceAttrSet ("scaleway_apple_silicon_runner.main" , "status" ),
8958 ),
9059 },
9160 },
@@ -134,7 +103,7 @@ func isRunnerDestroyed(tt *acctest.TestTools) resource.TestCheckFunc {
134103 return fmt .Errorf ("runner still exists: %s" , rs .Primary .ID )
135104 }
136105
137- if ! httperrors .Is404 (err ) {
106+ if ! httperrors .Is403 (err ) {
138107 return fmt .Errorf ("unexpected error: %s" , err )
139108 }
140109 }
0 commit comments