Skip to content

Commit

Permalink
fix: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
S-H1129 authored and mura-s committed Apr 22, 2021
1 parent cfcc6e2 commit 8e70ee0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
5 changes: 3 additions & 2 deletions pkg/bucketeer/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package bucketeer

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"go.opencensus.io/stats/view"
"go.opencensus.io/tag"
"testing"
)

func TestRegisterMetrics(t *testing.T) {
Expand All @@ -26,7 +27,7 @@ func TestNewMetricsContext(t *testing.T) {
assert.Equal(t, expectedCtx, ctx)
}

func TestNewLatencyDistribution(t *testing.T){
func TestNewLatencyDistribution(t *testing.T) {
expected := view.Distribution(25, 50, 100, 200, 400, 800, 1600, 3200, 6400).Buckets
assert.Equal(t, expected, newLatencyDistribution().Buckets)
}
3 changes: 2 additions & 1 deletion pkg/bucketeer/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"encoding/json"
"errors"
"fmt"
"go.opencensus.io/tag"
"strconv"
"time"

"go.opencensus.io/tag"

"github.com/golang/protobuf/proto" // nolint:staticcheck
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
34 changes: 17 additions & 17 deletions pkg/bucketeer/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestBoolVariation(t *testing.T) {
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushInternalErrorCountMetricsEvent(ctx, sdkTag)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -74,7 +74,7 @@ func TestBoolVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -101,7 +101,7 @@ func TestBoolVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushEvaluationEvent(
context.Background(),
ctx,
user.User,
res.Evaluation,
)
Expand Down Expand Up @@ -147,7 +147,7 @@ func TestIntVariation(t *testing.T) {
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushInternalErrorCountMetricsEvent(ctx, sdkTag)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -174,7 +174,7 @@ func TestIntVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -201,7 +201,7 @@ func TestIntVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushEvaluationEvent(
context.Background(),
ctx,
user.User,
res.Evaluation,
)
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestInt64Variation(t *testing.T) {
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushInternalErrorCountMetricsEvent(ctx, sdkTag)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -274,7 +274,7 @@ func TestInt64Variation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -301,7 +301,7 @@ func TestInt64Variation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushEvaluationEvent(
context.Background(),
ctx,
user.User,
res.Evaluation,
)
Expand Down Expand Up @@ -347,7 +347,7 @@ func TestFloat64Variation(t *testing.T) {
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushInternalErrorCountMetricsEvent(ctx, sdkTag)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -374,7 +374,7 @@ func TestFloat64Variation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -401,7 +401,7 @@ func TestFloat64Variation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushEvaluationEvent(
context.Background(),
ctx,
user.User,
res.Evaluation,
)
Expand Down Expand Up @@ -447,7 +447,7 @@ func TestStringVariation(t *testing.T) {
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushInternalErrorCountMetricsEvent(ctx, sdkTag)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -474,7 +474,7 @@ func TestStringVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushEvaluationEvent(
context.Background(),
ctx,
user.User,
res.Evaluation,
)
Expand Down Expand Up @@ -524,7 +524,7 @@ func TestJSONVariation(t *testing.T) {
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushInternalErrorCountMetricsEvent(ctx, sdkTag)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -551,7 +551,7 @@ func TestJSONVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushDefaultEvaluationEvent(
context.Background(),
ctx,
user.User,
featureID,
)
Expand All @@ -578,7 +578,7 @@ func TestJSONVariation(t *testing.T) {
sdkTag,
)
s.eventProcessor.(*mockevent.MockProcessor).EXPECT().PushEvaluationEvent(
context.Background(),
ctx,
user.User,
res.Evaluation,
)
Expand Down

0 comments on commit 8e70ee0

Please sign in to comment.