// No resources already at their desired states.
// Everything gets applied and updates its state.
No resources already at their desired states.
Everything gets applied and updates its state.
// No resources already at their desired states . // Everything gets applied and updates its state .
func TestStraightLinePlanApplyAllValid(t *testing.T) {
	r := &testutils.MockRunner{Output: "", Err: nil}
	b := NewBuilder()
	b.AddResource("resource-1",
		&testResource{
			ID:                   "resource-1",
			StatesShouldNotMatch: true})
	b.AddResource("resource-2",
		&testResource{
			ID:                   "resource-2",
			StatesShouldNotMatch: true}, DependOn("resource-1"))
	b.AddResource("resource-3",
		&testResource{
			ID:                   "resource-3",
			StatesShouldNotMatch: true}, DependOn("resource-2"))
	b.AddResource("resource-4",
		&testResource{
			ID:                   "resource-4",
			StatesShouldNotMatch: true}, DependOn("resource-3"))
	assert.Equal(t, 0, len(b.Errors()))
	p, err := b.Plan()
	assert.NoError(t, err)
	diff := Diff{
		CurrentState:    EmptyState,
		InvalidatedDeps: []Resource{}}
	propagate, err := p.Apply(r, diff)
	assert.True(t, propagate)
	assert.NoError(t, err)
}
func TestStraightLinePlanApplyAllValid ( 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 : EmptyState , InvalidatedDeps : [ ] Resource { } } propagate , err := p . Apply ( r , diff ) assert . True ( t , propagate ) assert . NoError ( t , err ) }
No resources already at their desired states.
No resources already at their desired states .