terraform: some basic validation

This commit is contained in:
Mitchell Hashimoto 2014-06-30 21:25:15 -07:00
parent 8aa8d2183e
commit fceea12ade
2 changed files with 10 additions and 0 deletions

View File

@ -77,6 +77,10 @@ type GraphNodeResourceProvider struct {
// configured at this point.
//
func Graph(opts *GraphOpts) (*depgraph.Graph, error) {
if opts.Config == nil {
return nil, errors.New("Config is required for Graph")
}
g := new(depgraph.Graph)
// First, build the initial resource graph. This only has the resources

View File

@ -21,6 +21,12 @@ func TestGraph(t *testing.T) {
}
}
func TestGraph_configRequired(t *testing.T) {
if _, err := Graph(new(GraphOpts)); err == nil {
t.Fatal("should error")
}
}
func TestGraph_cycle(t *testing.T) {
config := testConfig(t, "graph-cycle")