// Tests real Resources in the main 'resource' package
Tests real Resources in the main 'resource' package
// Tests real Resources in the main ' resource ' package
func TestPlanToJSON(t *testing.T) {
	b := plan.NewBuilder()
	b.AddResource("rpm:foo", &RPM{Name: "foo", Version: "2"})
	b.AddResource("service:bar", &Service{Name: "bar", Status: "OK", Enabled: true}, plan.DependOn("rpm:foo"))
	b.AddResource("file:baz", &File{Source: "/tmp/x", Destination: "/etc/y"}, plan.DependOn("service:bar", "rpm:foo"))
	pin, err := b.Plan()
	assert.NoError(t, err)
	pout, err := plan.NewPlanFromJSON(strings.NewReader(pin.ToJSON()))
	assert.NoError(t, err)
	assert.True(t, plan.EqualPlans(pin, pout))
}
func TestPlanToJSON ( t * testing . T ) { b := plan . NewBuilder ( ) b . AddResource ( " " , & RPM { Name : " " , Version : " " } ) b . AddResource ( " " , & Service { Name : " " , Status : " " , Enabled : true } , plan . DependOn ( " " ) ) b . AddResource ( " " , & File { Source : " " , Destination : " " } , plan . DependOn ( " " , " " ) ) pin , err := b . Plan ( ) assert . NoError ( t , err ) pout , err := plan . NewPlanFromJSON ( strings . NewReader ( pin . ToJSON ( ) ) ) assert . NoError ( t , err ) assert . True ( t , plan . EqualPlans ( pin , pout ) ) }
Tests real Resources in the main 'resource' package
Tests real Resources in the main ' resource ' package