terraform: tests that some other graph nodes implement the interfaces
This commit is contained in:
parent
01ec680019
commit
c0695b0657
|
@ -3,11 +3,40 @@ package terraform
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/config"
|
||||
"github.com/hashicorp/terraform/dag"
|
||||
)
|
||||
|
||||
func TestGraphNodeConfigProvider_impl(t *testing.T) {
|
||||
var _ dag.Vertex = new(GraphNodeConfigProvider)
|
||||
var _ dag.NamedVertex = new(GraphNodeConfigProvider)
|
||||
var _ graphNodeConfig = new(GraphNodeConfigProvider)
|
||||
var _ GraphNodeProvider = new(GraphNodeConfigProvider)
|
||||
}
|
||||
|
||||
func TestGraphNodeConfigProvider_ProviderName(t *testing.T) {
|
||||
n := &GraphNodeConfigProvider{
|
||||
Provider: &config.ProviderConfig{Name: "foo"},
|
||||
}
|
||||
|
||||
if v := n.ProviderName(); v != "foo" {
|
||||
t.Fatalf("bad: %#v", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGraphNodeConfigResource_impl(t *testing.T) {
|
||||
var _ dag.Vertex = new(GraphNodeConfigResource)
|
||||
var _ dag.NamedVertex = new(GraphNodeConfigResource)
|
||||
var _ graphNodeConfig = new(GraphNodeConfigResource)
|
||||
var _ GraphNodeProviderConsumer = new(GraphNodeConfigResource)
|
||||
}
|
||||
|
||||
func TestGraphNodeConfigResource_ProvidedBy(t *testing.T) {
|
||||
n := &GraphNodeConfigResource{
|
||||
Resource: &config.Resource{Type: "aws_instance"},
|
||||
}
|
||||
|
||||
if v := n.ProvidedBy(); v != "aws" {
|
||||
t.Fatalf("bad: %#v", v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,10 @@ func (n *graphNodeOrphanResource) Name() string {
|
|||
return fmt.Sprintf("%s (orphan)", n.ResourceName)
|
||||
}
|
||||
|
||||
func (n *graphNodeOrphanResource) ProvidedBy() string {
|
||||
return resourceProvider(n.ResourceName)
|
||||
}
|
||||
|
||||
func (n *graphNodeOrphanResource) dependableName() string {
|
||||
return n.ResourceName
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package terraform
|
|||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/dag"
|
||||
)
|
||||
|
||||
func TestOrphanTransformer(t *testing.T) {
|
||||
|
@ -259,6 +261,19 @@ func TestOrphanTransformer_resourceDepends(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGraphNodeOrphanResource_impl(t *testing.T) {
|
||||
var _ dag.Vertex = new(graphNodeOrphanResource)
|
||||
var _ dag.NamedVertex = new(graphNodeOrphanResource)
|
||||
var _ GraphNodeProviderConsumer = new(graphNodeOrphanResource)
|
||||
}
|
||||
|
||||
func TestGraphNodeOrphanResource_ProvidedBy(t *testing.T) {
|
||||
n := &graphNodeOrphanResource{ResourceName: "aws_instance.foo"}
|
||||
if v := n.ProvidedBy(); v != "aws" {
|
||||
t.Fatalf("bad: %#v", v)
|
||||
}
|
||||
}
|
||||
|
||||
const testTransformOrphanBasicStr = `
|
||||
aws_instance.db (orphan)
|
||||
aws_instance.web
|
||||
|
|
|
@ -56,3 +56,7 @@ func (n *graphNodeTaintedResource) DependentOn() []string {
|
|||
func (n *graphNodeTaintedResource) Name() string {
|
||||
return fmt.Sprintf("%s (tainted #%d)", n.ResourceName, n.Index+1)
|
||||
}
|
||||
|
||||
func (n *graphNodeTaintedResource) ProvidedBy() string {
|
||||
return resourceProvider(n.ResourceName)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package terraform
|
|||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/dag"
|
||||
)
|
||||
|
||||
func TestTaintedTransformer(t *testing.T) {
|
||||
|
@ -43,6 +45,19 @@ func TestTaintedTransformer(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGraphNodeTaintedResource_impl(t *testing.T) {
|
||||
var _ dag.Vertex = new(graphNodeTaintedResource)
|
||||
var _ dag.NamedVertex = new(graphNodeTaintedResource)
|
||||
var _ GraphNodeProviderConsumer = new(graphNodeTaintedResource)
|
||||
}
|
||||
|
||||
func TestGraphNodeTaintedResource_ProvidedBy(t *testing.T) {
|
||||
n := &graphNodeTaintedResource{ResourceName: "aws_instance.foo"}
|
||||
if v := n.ProvidedBy(); v != "aws" {
|
||||
t.Fatalf("bad: %#v", v)
|
||||
}
|
||||
}
|
||||
|
||||
const testTransformTaintedBasicStr = `
|
||||
aws_instance.web
|
||||
aws_instance.web (tainted #1)
|
||||
|
|
Loading…
Reference in New Issue