providers/google: tests passing, compiling

This commit is contained in:
Mitchell Hashimoto 2014-09-16 17:16:53 -07:00
parent 55f4e35586
commit ecc10616ba
6 changed files with 36 additions and 36 deletions

View File

@ -31,13 +31,13 @@ func TestAccComputeAddress_basic(t *testing.T) {
func testAccCheckComputeAddressDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.Resources {
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_address" {
continue
}
_, err := config.clientCompute.Addresses.Get(
config.Project, config.Region, rs.ID).Do()
config.Project, config.Region, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Address still exists")
}
@ -48,24 +48,24 @@ func testAccCheckComputeAddressDestroy(s *terraform.State) error {
func testAccCheckComputeAddressExists(n string, addr *compute.Address) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.Resources[n]
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.ID == "" {
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.Addresses.Get(
config.Project, config.Region, rs.ID).Do()
config.Project, config.Region, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.ID {
if found.Name != rs.Primary.ID {
return fmt.Errorf("Addr not found")
}

View File

@ -31,13 +31,13 @@ func TestAccComputeDisk_basic(t *testing.T) {
func testAccCheckComputeDiskDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.Resources {
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_disk" {
continue
}
_, err := config.clientCompute.Disks.Get(
config.Project, rs.Attributes["zone"], rs.ID).Do()
config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Disk still exists")
}
@ -48,24 +48,24 @@ func testAccCheckComputeDiskDestroy(s *terraform.State) error {
func testAccCheckComputeDiskExists(n string, disk *compute.Disk) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.Resources[n]
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.ID == "" {
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.Disks.Get(
config.Project, rs.Attributes["zone"], rs.ID).Do()
config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.ID {
if found.Name != rs.Primary.ID {
return fmt.Errorf("Disk not found")
}

View File

@ -59,13 +59,13 @@ func TestAccComputeFirewall_update(t *testing.T) {
func testAccCheckComputeFirewallDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.Resources {
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_firewall" {
continue
}
_, err := config.clientCompute.Firewalls.Get(
config.Project, rs.ID).Do()
config.Project, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Firewall still exists")
}
@ -76,24 +76,24 @@ func testAccCheckComputeFirewallDestroy(s *terraform.State) error {
func testAccCheckComputeFirewallExists(n string, firewall *compute.Firewall) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.Resources[n]
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.ID == "" {
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.Firewalls.Get(
config.Project, rs.ID).Do()
config.Project, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.ID {
if found.Name != rs.Primary.ID {
return fmt.Errorf("Firewall not found")
}

View File

@ -106,13 +106,13 @@ func TestAccComputeInstance_update(t *testing.T) {
func testAccCheckComputeInstanceDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.Resources {
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_instance" {
continue
}
_, err := config.clientCompute.Instances.Get(
config.Project, rs.Attributes["zone"], rs.ID).Do()
config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Instance still exists")
}
@ -123,24 +123,24 @@ func testAccCheckComputeInstanceDestroy(s *terraform.State) error {
func testAccCheckComputeInstanceExists(n string, instance *compute.Instance) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.Resources[n]
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.ID == "" {
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.Instances.Get(
config.Project, rs.Attributes["zone"], rs.ID).Do()
config.Project, rs.Primary.Attributes["zone"], rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.ID {
if found.Name != rs.Primary.ID {
return fmt.Errorf("Instance not found")
}

View File

@ -31,13 +31,13 @@ func TestAccComputeNetwork_basic(t *testing.T) {
func testAccCheckComputeNetworkDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.Resources {
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_network" {
continue
}
_, err := config.clientCompute.Networks.Get(
config.Project, rs.ID).Do()
config.Project, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Network still exists")
}
@ -48,24 +48,24 @@ func testAccCheckComputeNetworkDestroy(s *terraform.State) error {
func testAccCheckComputeNetworkExists(n string, network *compute.Network) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.Resources[n]
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.ID == "" {
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.Networks.Get(
config.Project, rs.ID).Do()
config.Project, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.ID {
if found.Name != rs.Primary.ID {
return fmt.Errorf("Network not found")
}

View File

@ -31,13 +31,13 @@ func TestAccComputeRoute_basic(t *testing.T) {
func testAccCheckComputeRouteDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
for _, rs := range s.Resources {
for _, rs := range s.RootModule().Resources {
if rs.Type != "google_compute_route" {
continue
}
_, err := config.clientCompute.Routes.Get(
config.Project, rs.ID).Do()
config.Project, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("Route still exists")
}
@ -48,24 +48,24 @@ func testAccCheckComputeRouteDestroy(s *terraform.State) error {
func testAccCheckComputeRouteExists(n string, route *compute.Route) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.Resources[n]
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.ID == "" {
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
found, err := config.clientCompute.Routes.Get(
config.Project, rs.ID).Do()
config.Project, rs.Primary.ID).Do()
if err != nil {
return err
}
if found.Name != rs.ID {
if found.Name != rs.Primary.ID {
return fmt.Errorf("Route not found")
}