fmt
This commit is contained in:
parent
b43cfa3bb0
commit
36f225dea0
|
@ -92,7 +92,7 @@ func resource_aws_subnet_destroy(
|
|||
_, err := ec2conn.DeleteSubnet(s.ID)
|
||||
return err
|
||||
}
|
||||
if err := resource.Retry(10 * time.Second, f); err != nil {
|
||||
if err := resource.Retry(10*time.Second, f); err != nil {
|
||||
ec2err, ok := err.(*ec2.Error)
|
||||
if ok && ec2err.Code == "InvalidSubnetID.NotFound" {
|
||||
return nil
|
||||
|
|
|
@ -172,10 +172,10 @@ func Test_flattenIPPerms(t *testing.T) {
|
|||
func Test_expandListeners(t *testing.T) {
|
||||
expanded := []interface{}{
|
||||
map[string]interface{}{
|
||||
"instance_port": 8000,
|
||||
"lb_port": 80,
|
||||
"instance_port": 8000,
|
||||
"lb_port": 80,
|
||||
"instance_protocol": "http",
|
||||
"lb_protocol": "http",
|
||||
"lb_protocol": "http",
|
||||
},
|
||||
}
|
||||
listeners, err := expandListeners(expanded)
|
||||
|
|
|
@ -42,7 +42,7 @@ func resourceComputeDisk() *schema.Resource {
|
|||
},
|
||||
|
||||
"type": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
|
|
@ -211,7 +211,7 @@ func resourceComputeInstanceCreate(d *schema.ResourceData, meta interface{}) err
|
|||
}
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk(prefix + ".type"); ok {
|
||||
if v, ok := d.GetOk(prefix + ".type"); ok {
|
||||
diskTypeName := v.(string)
|
||||
diskType, err := readDiskType(config, zone, diskTypeName)
|
||||
if err != nil {
|
||||
|
|
|
@ -243,7 +243,7 @@ func TestConfigValidate_varModuleInvalid(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNameRegexp(t *testing.T) {
|
||||
cases := []struct{
|
||||
cases := []struct {
|
||||
Input string
|
||||
Match bool
|
||||
}{
|
||||
|
|
|
@ -26,8 +26,8 @@ type interpolationWalker struct {
|
|||
//
|
||||
// If Replace is true, then the return value of F will be used to
|
||||
// replace the interpolation.
|
||||
F interpolationWalkerFunc
|
||||
Replace bool
|
||||
F interpolationWalkerFunc
|
||||
Replace bool
|
||||
|
||||
// ContextF is an advanced version of F that also receives the
|
||||
// location of where it is in the structure. This lets you do
|
||||
|
|
|
@ -19,7 +19,7 @@ func TestRetry(t *testing.T) {
|
|||
return fmt.Errorf("error")
|
||||
}
|
||||
|
||||
err := Retry(2 * time.Second, f)
|
||||
err := Retry(2*time.Second, f)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ func TestRetry_timeout(t *testing.T) {
|
|||
return fmt.Errorf("always")
|
||||
}
|
||||
|
||||
err := Retry(1 * time.Second, f)
|
||||
err := Retry(1*time.Second, f)
|
||||
if err == nil {
|
||||
t.Fatal("should error")
|
||||
}
|
||||
|
|
|
@ -451,8 +451,8 @@ func TestSchemaMap_Diff(t *testing.T) {
|
|||
Diff: &terraform.InstanceDiff{
|
||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||
"ports.#": &terraform.ResourceAttrDiff{
|
||||
Old: "0",
|
||||
New: "",
|
||||
Old: "0",
|
||||
New: "",
|
||||
NewComputed: true,
|
||||
},
|
||||
},
|
||||
|
@ -713,8 +713,8 @@ func TestSchemaMap_Diff(t *testing.T) {
|
|||
Diff: &terraform.InstanceDiff{
|
||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||
"ports.#": &terraform.ResourceAttrDiff{
|
||||
Old: "0",
|
||||
New: "",
|
||||
Old: "0",
|
||||
New: "",
|
||||
NewComputed: true,
|
||||
},
|
||||
},
|
||||
|
|
2
log.go
2
log.go
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
// These are the environmental variables that determine if we log, and if
|
||||
// we log whether or not the log should go to a file.
|
||||
const EnvLog = "TF_LOG" //Set to True
|
||||
const EnvLog = "TF_LOG" //Set to True
|
||||
const EnvLogFile = "TF_LOG_PATH" //Set to a file
|
||||
|
||||
// logOutput determines where we should send logs (if anywhere).
|
||||
|
|
|
@ -221,49 +221,49 @@ func graphDotAddResources(
|
|||
|
||||
// Handle the meta resources
|
||||
/*
|
||||
edgeBuf.Reset()
|
||||
for _, n := range g.Nouns {
|
||||
_, ok := n.Meta.(*GraphNodeResourceMeta)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
// Determine which edges to add
|
||||
var edges []digraph.Edge
|
||||
if hasDiff {
|
||||
for _, e := range n.Edges() {
|
||||
rn, ok := e.Tail().(*depgraph.Noun).Meta.(*GraphNodeResource)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if rn.Resource.Diff == nil || rn.Resource.Diff.Empty() {
|
||||
continue
|
||||
}
|
||||
edges = append(edges, e)
|
||||
edgeBuf.Reset()
|
||||
for _, n := range g.Nouns {
|
||||
_, ok := n.Meta.(*GraphNodeResourceMeta)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
edges = n.Edges()
|
||||
}
|
||||
|
||||
// Do not draw if we have no edges
|
||||
if len(edges) == 0 {
|
||||
continue
|
||||
}
|
||||
// Determine which edges to add
|
||||
var edges []digraph.Edge
|
||||
if hasDiff {
|
||||
for _, e := range n.Edges() {
|
||||
rn, ok := e.Tail().(*depgraph.Noun).Meta.(*GraphNodeResource)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if rn.Resource.Diff == nil || rn.Resource.Diff.Empty() {
|
||||
continue
|
||||
}
|
||||
edges = append(edges, e)
|
||||
}
|
||||
} else {
|
||||
edges = n.Edges()
|
||||
}
|
||||
|
||||
uniqueName := fmt.Sprintf("%d_%s", opts.depth, n)
|
||||
for _, e := range edges {
|
||||
target := e.Tail()
|
||||
uniqueTarget := fmt.Sprintf("%d_%s", opts.depth, target)
|
||||
edgeBuf.WriteString(fmt.Sprintf(
|
||||
"\t\"%s\" -> \"%s\";\n",
|
||||
uniqueName,
|
||||
uniqueTarget))
|
||||
// Do not draw if we have no edges
|
||||
if len(edges) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
uniqueName := fmt.Sprintf("%d_%s", opts.depth, n)
|
||||
for _, e := range edges {
|
||||
target := e.Tail()
|
||||
uniqueTarget := fmt.Sprintf("%d_%s", opts.depth, target)
|
||||
edgeBuf.WriteString(fmt.Sprintf(
|
||||
"\t\"%s\" -> \"%s\";\n",
|
||||
uniqueName,
|
||||
uniqueTarget))
|
||||
}
|
||||
}
|
||||
if edgeBuf.Len() > 0 {
|
||||
buf.WriteString(edgeBuf.String())
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
}
|
||||
if edgeBuf.Len() > 0 {
|
||||
buf.WriteString(edgeBuf.String())
|
||||
buf.WriteString("\n")
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -463,16 +463,16 @@ func TestGraphAddDiff(t *testing.T) {
|
|||
}
|
||||
|
||||
/*
|
||||
TODO: test this somewhere
|
||||
// Verify that the state has been added
|
||||
n := g.Noun("aws_instance.foo")
|
||||
rn := n.Meta.(*GraphNodeResource)
|
||||
TODO: test this somewhere
|
||||
// Verify that the state has been added
|
||||
n := g.Noun("aws_instance.foo")
|
||||
rn := n.Meta.(*GraphNodeResource)
|
||||
|
||||
expected2 := diff.RootModule().Resources["aws_instance.foo"]
|
||||
actual2 := rn.Resource.Diff
|
||||
if !reflect.DeepEqual(actual2, expected2) {
|
||||
t.Fatalf("bad: %#v", actual2)
|
||||
}
|
||||
expected2 := diff.RootModule().Resources["aws_instance.foo"]
|
||||
actual2 := rn.Resource.Diff
|
||||
if !reflect.DeepEqual(actual2, expected2) {
|
||||
t.Fatalf("bad: %#v", actual2)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
|
@ -921,4 +921,3 @@ STATE:
|
|||
|
||||
<no state>
|
||||
`
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@ package terraform
|
|||
|
||||
// MockUIOutput is an implementation of UIOutput that can be used for tests.
|
||||
type MockUIOutput struct {
|
||||
OutputCalled bool
|
||||
OutputMessage string
|
||||
OutputFn func(string)
|
||||
OutputCalled bool
|
||||
OutputMessage string
|
||||
OutputFn func(string)
|
||||
}
|
||||
|
||||
func (o *MockUIOutput) Output(v string) {
|
||||
o.OutputCalled = true
|
||||
o.OutputMessage= v
|
||||
o.OutputMessage = v
|
||||
if o.OutputFn != nil {
|
||||
o.OutputFn(v)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue