Merge pull request #1359 from hashicorp/b-do-ssh-key-test
providers/digitalocean: fix ssh key test
This commit is contained in:
commit
de1a58512a
|
@ -2,6 +2,8 @@ package digitalocean
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
|
@ -25,7 +27,7 @@ func TestAccDigitalOceanSSHKey_Basic(t *testing.T) {
|
|||
resource.TestCheckResourceAttr(
|
||||
"digitalocean_ssh_key.foobar", "name", "foobar"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"digitalocean_ssh_key.foobar", "public_key", "abcdef"),
|
||||
"digitalocean_ssh_key.foobar", "public_key", testAccValidPublicKey),
|
||||
),
|
||||
},
|
||||
},
|
||||
|
@ -82,7 +84,7 @@ func testAccCheckDigitalOceanSSHKeyExists(n string, key *digitalocean.SSHKey) re
|
|||
return err
|
||||
}
|
||||
|
||||
if foundKey.Name != rs.Primary.ID {
|
||||
if strconv.Itoa(int(foundKey.Id)) != rs.Primary.ID {
|
||||
return fmt.Errorf("Record not found")
|
||||
}
|
||||
|
||||
|
@ -92,8 +94,12 @@ func testAccCheckDigitalOceanSSHKeyExists(n string, key *digitalocean.SSHKey) re
|
|||
}
|
||||
}
|
||||
|
||||
const testAccCheckDigitalOceanSSHKeyConfig_basic = `
|
||||
var testAccCheckDigitalOceanSSHKeyConfig_basic = fmt.Sprintf(`
|
||||
resource "digitalocean_ssh_key" "foobar" {
|
||||
name = "foobar"
|
||||
public_key = "abcdef"
|
||||
}`
|
||||
public_key = "%s"
|
||||
}`, testAccValidPublicKey)
|
||||
|
||||
var testAccValidPublicKey = strings.TrimSpace(`
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR
|
||||
`)
|
||||
|
|
Loading…
Reference in New Issue