Skip to content

Commit

Permalink
[1.3.0] Add Missing Tests [API-1112] (#703)
Browse files Browse the repository at this point in the history
* add missing tests

* add http client tests

* try enabling TestClient_AddDistributedObjectListener

* exclude unused codec files from test coverage

* exclude unused codec files from test coverage

* refactor test structs for field alignment check

* test http client retry mechanism

* fix bad merge

* address review comments

* refactor index variables "ind" to "i"

* field reordering for "fieldalignment"

* undo wrong file remove
  • Loading branch information
utku-caglayan authored Feb 18, 2022
1 parent a2d404d commit 5ff41fe
Show file tree
Hide file tree
Showing 8 changed files with 384 additions and 239 deletions.
88 changes: 88 additions & 0 deletions aggregate/aggregate_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package aggregate

import (
"fmt"
"testing"
)

func TestMakeString(t *testing.T) {
tcs := []struct {
name string
attrPath string
want string
}{
{
name: "test",
attrPath: "attribute",
want: "test(attribute)",
},
{
name: "",
attrPath: "",
want: "()",
},
}
for i, tt := range tcs {
t.Run(fmt.Sprintf("makeString case: %d", i), func(t *testing.T) {
if got := makeString(tt.name, tt.attrPath); got != tt.want {
t.Errorf("makeString() = %v, want %v", got, tt.want)
}
})
}
}

func TestAggStringer(t *testing.T) {
tcs := []struct {
aggInstance fmt.Stringer
want string
}{
{
aggInstance: Count("attribute"),
want: "Count(attribute)",
},
{
aggInstance: DistinctValues("attribute"),
want: "DistinctValues(attribute)",
},
{
aggInstance: DoubleSum("attribute"),
want: "DoubleSum(attribute)",
},
{
aggInstance: DoubleAverage("attribute"),
want: "DoubleAverage(attribute)",
},
{
aggInstance: IntSum("attribute"),
want: "IntSum(attribute)",
},
{
aggInstance: IntAverage("attribute"),
want: "IntAverage(attribute)",
},
{
aggInstance: LongSum("attribute"),
want: "LongSum(attribute)",
},
{
aggInstance: LongAverage("attribute"),
want: "LongAverage(attribute)",
},
{
aggInstance: Max("attribute"),
want: "Max(attribute)",
},

{
aggInstance: Min("attribute"),
want: "Min(attribute)",
},
}
for i, tt := range tcs {
t.Run(fmt.Sprintf("makeString case: %d", i), func(t *testing.T) {
if got := tt.aggInstance.String(); got != tt.want {
t.Errorf("String() = %v, want %v", got, tt.want)
}
})
}
}
4 changes: 2 additions & 2 deletions internal/invocation/stripe_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Test_defaultExecFn(t *testing.T) {
}

func TestStripeExecutor_dispatch(t *testing.T) {
tests := []struct {
tcs := []struct {
queueCount int
key int
expectedIndex int
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestStripeExecutor_dispatch(t *testing.T) {
expectedIndex: 0,
},
}
for i, tt := range tests {
for i, tt := range tcs {
t.Run(fmt.Sprintf("QueueCount: %d, Key: %d", tt.queueCount, tt.key), func(t *testing.T) {
se := newStripeExecutorWithConfig(tt.queueCount, 10_000)
task := func() {
Expand Down
6 changes: 0 additions & 6 deletions internal/proto/codec/error_holder_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ const (
ErrorHolderCodecErrorCodeInitialFrameSize = ErrorHolderCodecErrorCodeFieldOffset + proto.IntSizeInBytes
)

/*
type errorholderCodec struct {}
var ErrorHolderCodec errorholderCodec
*/

func EncodeErrorHolder(clientMessage *proto.ClientMessage, errorHolder proto.ErrorHolder) {
clientMessage.AddFrame(proto.BeginFrame.Copy())
initialFrame := proto.NewFrame(make([]byte, ErrorHolderCodecErrorCodeInitialFrameSize))
Expand Down
54 changes: 0 additions & 54 deletions internal/proto/codec/list_iterator_codec.go

This file was deleted.

59 changes: 0 additions & 59 deletions internal/proto/codec/list_list_iterator_codec.go

This file was deleted.

58 changes: 0 additions & 58 deletions internal/proto/codec/map_fetch_entries_codec.go

This file was deleted.

60 changes: 0 additions & 60 deletions internal/proto/codec/map_submit_to_key_codec.go

This file was deleted.

Loading

0 comments on commit 5ff41fe

Please sign in to comment.