Example #1
0
func compareBuckets(a, b leakybucket.Bucket) error {
	if a.Remaining() != b.Remaining() {
		return fmt.Errorf("first has %d remaining, second has %d remaining", a.Remaining(), b.Remaining())
	}
	return compareBucketTimes(a, b)
}
Example #2
0
func compareBucketTimes(a, b leakybucket.Bucket) error {
	if a.Reset().Unix() == b.Reset().Unix() {
		return nil
	}
	return fmt.Errorf("first has %#v reset, second has %#v reset", a.Reset().Unix(), b.Reset().Unix())
}