Skip to content

Commit

Permalink
Fixed issues from vet and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwarwick authored Jul 7, 2017
2 parents 47c0591 + 304e43f commit f9cb0ad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions infoblox/resource_a_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func testAccResourceARecordDestroy(state *terraform.State) error {
}

if api.GetResponse().Name == "arecordcreated.test-ovp.bskyb.com" {
return fmt.Errorf("A record still exists", api.GetResponse())
return fmt.Errorf("A record still exists: %+v", api.GetResponse())
}

}
Expand All @@ -67,7 +67,7 @@ func testAccResourceARecordExists(recordName, resourceName string) resource.Test
return func(state *terraform.State) error {
rs, ok := state.RootModule().Resources[resourceName]
if !ok {
return fmt.Errorf("\nInfoblox A record resource %s not found in resources", resourceName)
return fmt.Errorf("\nInfoblox A record resource %s not found in resources: ", resourceName)
}
if rs.Primary.ID == "" {
return fmt.Errorf("\nInfoblox A record resource %s ID not set", resourceName)
Expand All @@ -77,7 +77,7 @@ func testAccResourceARecordExists(recordName, resourceName string) resource.Test
getAllARec := records.NewGetAllARecords(fields)
err := infobloxClient.Do(getAllARec)
if err != nil {
return fmt.Errorf("Error getting the A record", err)
return fmt.Errorf("Error getting the A record: %+v", err)
}
for _, x := range getAllARec.GetResponse() {
if x.Name == recordName {
Expand Down
9 changes: 6 additions & 3 deletions infoblox/resource_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func testAccResourceNetworkDestroy(state *terraform.State) error {
}

if api.GetResponse().Network == "arecordcreated.test-ovp.bskyb.com" {
return fmt.Errorf("Network still exists", api.GetResponse())
return fmt.Errorf("Network still exists: %+v", api.GetResponse())
}

}
Expand All @@ -65,6 +65,9 @@ func testAccResourceNetworkDestroy(state *terraform.State) error {

func testAccResourceNetworkExists(networkAddr, resourceName string) resource.TestCheckFunc {
return func(state *terraform.State) error {

var fields []string

rs, ok := state.RootModule().Resources[resourceName]
if !ok {
return fmt.Errorf("\nInfoblox Network resource %s not found in resources", resourceName)
Expand All @@ -73,10 +76,10 @@ func testAccResourceNetworkExists(networkAddr, resourceName string) resource.Tes
return fmt.Errorf("\nInfoblox Network resource %s ID not set", resourceName)
}
infobloxClient := testAccProvider.Meta().(*skyinfoblox.InfobloxClient)
getAllARec := network.NewGetAllNetworks()
getAllARec := network.NewGetAllNetworks(fields)
err := infobloxClient.Do(getAllARec)
if err != nil {
return fmt.Errorf("Error getting the A record", err)
return fmt.Errorf("Error getting the A record: %q", err.Error())
}
for _, x := range getAllARec.GetResponse() {
if x.Network == networkAddr {
Expand Down
4 changes: 2 additions & 2 deletions infoblox/resource_srv_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func testAccResourceSRVRecordExists(recordName, resourceName string) resource.Te
err := infobloxClient.Do(getAllSRVRecords)

if err != nil {
return fmt.Errorf("Error getting the SRV record", err)
return fmt.Errorf("Error getting the SRV record: %q", err.Error())
}
for _, x := range getAllSRVRecords.GetResponse() {
if x.Name == recordName {
Expand Down Expand Up @@ -96,7 +96,7 @@ func testAccResourceSRVRecordDestroy(state *terraform.State) error {
}

if api.GetResponse().Name == "srv-recordcreated.test-ovp.bskyb.com" {
return fmt.Errorf("A record still exists", api.GetResponse())
return fmt.Errorf("A record still exists: %+v", api.GetResponse())
}

}
Expand Down
2 changes: 1 addition & 1 deletion infoblox/resource_txt_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func resourceTXTRecordRead(d *schema.ResourceData, m interface{}) error {
}

d.SetId("")
errStr := fmt.Sprintf("[resourceTXTRecordRead]:Return code: ", recordAPI.StatusCode())
errStr := fmt.Sprintf("[resourceTXTRecordRead]:Return code: %d", recordAPI.StatusCode())
return errors.New(errStr)
}

Expand Down
6 changes: 3 additions & 3 deletions infoblox/resource_txt_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func testAccResourceTXTRecordExists(recordName, resourceName string) resource.Te
return func(state *terraform.State) error {
rs, ok := state.RootModule().Resources[resourceName]
if !ok {
return fmt.Errorf("\nResource not found: ", resourceName)
return fmt.Errorf("\nResource not found: %s", resourceName)
}
if rs.Primary.ID == "" {
return fmt.Errorf("\nInfoblox TXT record resource %s ID not set", resourceName)
Expand All @@ -57,7 +57,7 @@ func testAccResourceTXTRecordExists(recordName, resourceName string) resource.Te
recAPI := records.NewGetTXTRecord(ref, fields)
err := infobloxClient.Do(recAPI)
if err != nil {
return fmt.Errorf("Error getting the TXT record", err)
return fmt.Errorf("Error getting the TXT record: %q", err.Error())
}
if recAPI.StatusCode() == http.StatusOK {
return nil
Expand All @@ -80,7 +80,7 @@ func testAccResourceTXTRecordDestroy(state *terraform.State) error {
}

if api.StatusCode() == http.StatusOK {
return fmt.Errorf("TXT record still exists, ref: ", ref)
return fmt.Errorf("TXT record still exists, ref: %v", ref)
}
return nil
}
Expand Down

0 comments on commit f9cb0ad

Please sign in to comment.