func TestCreateDefaultRule(t *testing.T) {
	m := &CentralizedManifest{
		Index: map[string]*CentralizedRule{},
	}
	reservoirSize := int64(10)
	fixedRate := float64(0.05)
	ruleName := "Default"
	new := &xraySvc.SamplingRule{
		ReservoirSize: &reservoirSize,
		FixedRate:     &fixedRate,
		RuleName:      &ruleName,
	}
	clock := &utils.DefaultClock{}
	rand := &utils.DefaultRand{}
	p := &Properties{
		FixedTarget: reservoirSize,
		Rate:        fixedRate,
	}
	cr := &CentralizedReservoir{
		reservoir: &reservoir{
			capacity: reservoirSize,
		},
		interval: 10,
	}
	exp := &CentralizedRule{
		reservoir:  cr,
		ruleName:   ruleName,
		Properties: p,
		clock:      clock,
		rand:       rand,
	}
	r, err := m.putRule(new)
	assert.Nil(t, err)
	assert.Equal(t, exp, r)
	assert.Equal(t, exp, m.Default)
}
Assert that putRule() creates a new default rule and adds to manifest
package sampling
import (
	"testing"
	"github.com/stretchr/testify/assert"
	xraySvc "github.com/aws/aws-sdk-go/service/xray"
	"github.com/aws/aws-xray-sdk-go/utils"
)
func TestCreateUserRule(t *testing.T) {
	resARN := "*"
	r1 := &CentralizedRule{
		ruleName: "r1",
		priority: 5,
	}
	r3 := &CentralizedRule{
		ruleName: "r3",
		priority: 7,
	}
	rules := []*CentralizedRule{r1, r3}
	index := map[string]*CentralizedRule{
		"r1": r1,
		"r3": r3,
	}
	m := &CentralizedManifest{
		Rules: rules,
		Index: index,
	}
	serviceName := "www.foo.com"
	httpMethod := "POST"
	urlPath := "/bar/*"
	reservoirSize := int64(10)
	fixedRate := float64(0.05)
	ruleName := "r2"
	host := "local"
	priority := int64(6)
	serviceTye := "*"
	new := &xraySvc.SamplingRule{
		ServiceName:   &serviceName,
		HTTPMethod:    &httpMethod,
		URLPath:       &urlPath,
		ReservoirSize: &reservoirSize,
		FixedRate:     &fixedRate,
		RuleName:      &ruleName,
		Priority:      &priority,
		Host:          &host,
		ServiceType:   &serviceTye,
		ResourceARN:   &resARN,
	}
	clock := &utils.DefaultClock{}
	rand := &utils.DefaultRand{}
	p := &Properties{
		ServiceName: serviceName,
		HTTPMethod:  httpMethod,
		URLPath:     urlPath,
		FixedTarget: reservoirSize,
		Rate:        fixedRate,
		Host:        host,
	}
	cr := &CentralizedReservoir{
		reservoir: &reservoir{
			capacity: 10,
		},
		interval: 10,
	}
	exp := &CentralizedRule{
		reservoir:   cr,
		ruleName:    ruleName,
		priority:    priority,
		Properties:  p,
		clock:       clock,
		rand:        rand,
		serviceType: serviceTye,
		resourceARN: resARN,
	}
	r2, err := m.putRule(new)
	assert.Nil(t, err)
	assert.Equal(t, exp, r2)
	r2, ok := m.Index["r2"]
	assert.True(t, ok)
	assert.Equal(t, exp, r2)
	r2 = m.Rules[2]
	assert.Equal(t, exp, r2)
}