github.com/richardbowden/terraform@v0.6.12-0.20160901200758-30ea22c25211/builtin/providers/rundeck/provider_test.go (about) 1 package rundeck 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/schema" 8 "github.com/hashicorp/terraform/terraform" 9 ) 10 11 // To run these acceptance tests, you will need a Rundeck server. 12 // An easy way to get one is to use Rundeck's "Anvils" demo, which includes a Vagrantfile 13 // to get it running easily: 14 // https://github.com/rundeck/anvils-demo 15 // The anvils demo ships with some example security policies that don't have enough access to 16 // run the tests, so you need to either modify one of the stock users to have full access or 17 // create a new user with such access. The following block is an example that gives the 18 // 'admin' user and API clients open access. 19 // In the anvils demo the admin password is "admin" by default. 20 21 // Place the contents of the following comment in /etc/rundeck/terraform-test.aclpolicy 22 /* 23 description: Admin, all access. 24 context: 25 project: '.*' # all projects 26 for: 27 resource: 28 - allow: '*' # allow read/create all kinds 29 adhoc: 30 - allow: '*' # allow read/running/killing adhoc jobs 31 job: 32 - allow: '*' # allow read/write/delete/run/kill of all jobs 33 node: 34 - allow: '*' # allow read/run for all nodes 35 by: 36 group: admin 37 --- 38 description: Admin, all access. 39 context: 40 application: 'rundeck' 41 for: 42 resource: 43 - allow: '*' # allow create of projects 44 project: 45 - allow: '*' # allow view/admin of all projects 46 storage: 47 - allow: '*' # allow read/create/update/delete for all /keys/* storage content 48 by: 49 group: admin 50 --- 51 description: Admin API, all access. 52 context: 53 application: 'rundeck' 54 for: 55 resource: 56 - allow: '*' # allow create of projects 57 project: 58 - allow: '*' # allow view/admin of all projects 59 storage: 60 - allow: '*' # allow read/create/update/delete for all /keys/* storage content 61 by: 62 group: api_token_group 63 */ 64 65 // Once you've got a user set up, put that user's API auth token in the RUNDECK_AUTH_TOKEN 66 // environment variable, and put the URL of the Rundeck home page in the RUNDECK_URL variable. 67 // If you're using the Anvils demo in its default configuration, you can find or generate an API 68 // token at http://192.168.50.2:4440/user/profile once you've logged in, and RUNDECK_URL will 69 // be http://192.168.50.2:4440/ . 70 71 var testAccProviders map[string]terraform.ResourceProvider 72 var testAccProvider *schema.Provider 73 74 func init() { 75 testAccProvider = Provider().(*schema.Provider) 76 testAccProviders = map[string]terraform.ResourceProvider{ 77 "rundeck": testAccProvider, 78 } 79 } 80 81 func TestProvider(t *testing.T) { 82 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 83 t.Fatalf("err: %s", err) 84 } 85 } 86 87 func TestProvider_impl(t *testing.T) { 88 var _ terraform.ResourceProvider = Provider() 89 } 90 91 func testAccPreCheck(t *testing.T) { 92 if v := os.Getenv("RUNDECK_URL"); v == "" { 93 t.Fatal("RUNDECK_URL must be set for acceptance tests") 94 } 95 if v := os.Getenv("RUNDECK_AUTH_TOKEN"); v == "" { 96 t.Fatal("RUNDECK_AUTH_TOKEN must be set for acceptance tests") 97 } 98 }