// Cached state passed in, no failure
Cached state passed in, no failure
// Cached state passed in no failure
func TestMultiLevelMultiDepApplyCachedState(t *testing.T) {
	r := &testutils.MockRunner{Output: "", Err: nil}
	b := NewBuilder("plan-1")
	b.AddResource("bottom-1",
		&testResource{
			ID:                   "bottom-1",
			StatesShouldNotMatch: true})
	b.AddResource("middle-1",
		&testResource{
			ID:                   "middle-1",
			StatesShouldNotMatch: true}, DependOn("bottom-1"))
	b.AddResource("middle-2",
		&testResource{
			ID:                   "middle-2",
			StatesShouldNotMatch: true}, DependOn("bottom-1"))
	b.AddResource("top",
		&testResource{
			ID:                   "top",
			StatesShouldNotMatch: true}, DependOn("bottom-1", "middle-1", "middle-2"))
	assert.Equal(t, 0, len(b.Errors()))
	p, err := b.Plan()
	assert.NoError(t, err)
	diff := Diff{
		CurrentState: State(map[string]interface{}{
			"bottom-1": State(map[string]interface{}{"bstate": 2}),
			"middle-1": State(map[string]interface{}{"m1state": 3}),
			"middle-2": State(map[string]interface{}{"m2state": 4}),
			"top":      State(map[string]interface{}{"tstate": 5})}),
		InvalidatedDeps: []Resource{}}
	propagate, err := p.Apply(r, diff)
	assert.NoError(t, err)
	assert.True(t, propagate)
}
func TestMultiLevelMultiDepApplyCachedState ( t * testing . T ) { r := & testutils . MockRunner { Output : " " , Err : nil } b := NewBuilder ( " " ) b . AddResource ( " " , & testResource { ID : " " , StatesShouldNotMatch : true } ) b . AddResource ( " " , & testResource { ID : " " , StatesShouldNotMatch : true } , DependOn ( " " ) ) b . AddResource ( " " , & testResource { ID : " " , StatesShouldNotMatch : true } , DependOn ( " " ) ) b . AddResource ( " " , & testResource { ID : " " , StatesShouldNotMatch : true } , DependOn ( " " , " " , " " ) ) assert . Equal ( t , 0 , len ( b . Errors ( ) ) ) p , err := b . Plan ( ) assert . NoError ( t , err ) diff := Diff { CurrentState : State ( map [ string ] interface { } { " " : State ( map [ string ] interface { } { " " : 2 } ) , " " : State ( map [ string ] interface { } { " " : 3 } ) , " " : State ( map [ string ] interface { } { " " : 4 } ) , " " : State ( map [ string ] interface { } { " " : 5 } ) } ) , InvalidatedDeps : [ ] Resource { } } propagate , err := p . Apply ( r , diff ) assert . NoError ( t , err ) assert . True ( t , propagate ) }
Cached state passed in, no failure
Cached state passed in no failure