Skip to content

Commit

Permalink
added spec version coverage in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmelograno committed May 14, 2024
1 parent c6b42a5 commit 145702f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 4 additions & 0 deletions splitio/sdk/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"testing"

"github.com/splitio/go-split-commons/v6/dtos"
"github.com/splitio/go-split-commons/v6/service/api/specs"
"github.com/splitio/go-toolkit/v5/logging"
"github.com/splitio/splitd/splitio/sdk/conf"
"github.com/splitio/splitd/splitio/sdk/types"
Expand Down Expand Up @@ -55,6 +56,9 @@ func TestInstantiationAndGetTreatmentE2E(t *testing.T) {
Till: 3,
}

assert.Equal(t, "-1", r.URL.Query().Get("since"))
assert.Equal(t, specs.FLAG_V1_1, r.URL.Query().Get("s"))

raw, err := json.Marshal(splitChanges)
assert.Nil(t, err)

Expand Down
24 changes: 10 additions & 14 deletions splitio/sdk/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ func TestTreatmentLabelsDisabled(t *testing.T) {
assert.Equal(t, 1, st.Len())

var imps []dtos.Impression
n, err := st.Pop(1, &imps)
n, _ := st.Pop(1, &imps)
assert.Nil(t, nil)
assert.Equal(t, 1, n)
assert.Equal(t, 1, len(imps))
assertImpEq(t, expectedImpression, &imps[0])
n, err = st.Pop(1, &imps)
st.Pop(1, &imps)
assert.ErrorIs(t, err, storage.ErrQueueEmpty)

})
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestTreatmentLabelsEnabled(t *testing.T) {
assert.Equal(t, 1, st.Len())

var imps []dtos.Impression
n, err := st.Pop(1, &imps)
n, _ := st.Pop(1, &imps)
assert.Nil(t, nil)
assert.Equal(t, 1, n)
assert.Equal(t, 1, len(imps))
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestTreatments(t *testing.T) {
assert.Equal(t, 3, st.Len())

var imps []dtos.Impression
n, err := st.Pop(3, &imps)
n, _ := st.Pop(3, &imps)
assert.Nil(t, nil)
assert.Equal(t, 3, n)
assert.Equal(t, 3, len(imps))
Expand Down Expand Up @@ -279,7 +279,7 @@ func TestTreatmentsByFlagSet(t *testing.T) {
assert.Equal(t, 3, st.Len())

var imps []dtos.Impression
n, err := st.Pop(3, &imps)
n, _ := st.Pop(3, &imps)
assert.Nil(t, nil)
assert.Equal(t, 3, n)
assert.Equal(t, 3, len(imps))
Expand Down Expand Up @@ -368,7 +368,7 @@ func TestTreatmentsByFlagSets(t *testing.T) {
assert.Equal(t, 3, st.Len())

var imps []dtos.Impression
n, err := st.Pop(3, &imps)
n, _ := st.Pop(3, &imps)
assert.Nil(t, nil)
assert.Equal(t, 3, n)
assert.Equal(t, 3, len(imps))
Expand Down Expand Up @@ -483,7 +483,7 @@ func TestTrack(t *testing.T) {
assert.Equal(t, 1, st.Len())

var evs []dtos.EventDTO
n, err := st.Pop(1, &evs)
n, _ := st.Pop(1, &evs)
assert.Nil(t, nil)
assert.Equal(t, 1, n)
assert.Equal(t, 1, len(evs))
Expand All @@ -494,7 +494,7 @@ func TestTrack(t *testing.T) {
Value: lang.Ref(123.4),
Properties: map[string]interface{}{"a": 123},
}, &evs[0])
n, err = st.Pop(1, &evs)
st.Pop(1, &evs)
assert.ErrorIs(t, err, storage.ErrQueueEmpty)

})
Expand Down Expand Up @@ -542,7 +542,7 @@ func TestTrackEventsFlush(t *testing.T) {
assert.Equal(t, 3, st.Len())

var evs []dtos.EventDTO
n, err := st.Pop(10, &evs)
n, _ := st.Pop(10, &evs)
assert.Nil(t, nil)
assert.Equal(t, 3, n)
assert.Equal(t, 3, len(evs))
Expand All @@ -561,7 +561,7 @@ func TestTrackEventsFlush(t *testing.T) {
expectedEvent.Key = "key3"
assertEventEq(t, &expectedEvent, &evs[2])

n, err = st.Pop(1, &evs)
st.Pop(1, &evs)
assert.ErrorIs(t, err, storage.ErrQueueEmpty)

})
Expand Down Expand Up @@ -659,7 +659,3 @@ func assertEventEq(t *testing.T, e1, e2 *dtos.EventDTO) {
assert.Equal(t, e1.Value, e2.Value)
assert.Equal(t, e1.Properties, e2.Properties)
}

func ref[T any](t T) *T {
return &t
}

0 comments on commit 145702f

Please sign in to comment.