Skip to content

Commit

Permalink
more controller work
Browse files Browse the repository at this point in the history
  • Loading branch information
mredolatti committed Nov 30, 2023
1 parent 3d3bf05 commit 5b22e14
Show file tree
Hide file tree
Showing 11 changed files with 697 additions and 694 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ images_release: # entrypoints
@echo "$(DOCKER) push splitsoftware/split-proxy:$(version)"
@echo "$(DOCKER) push splitsoftware/split-proxy:latest"

## display unit test coverage derived from last test run (use `make test display-coverage` for up-to-date results)
display-coverage: coverage.out
go tool cover -html=coverage.out

# --------------------------------------------------------------------------
#
# Internal targets:
Expand All @@ -106,6 +110,8 @@ images_release: # entrypoints
go.sum: go.mod
$(GO) mod tidy

coverage.out: test_coverage

# because of windows .exe suffix, we need a macro on the right side, which needs to be executed
# after the `%` evaluation, therefore, in a second expansion
.SECONDEXPANSION:
Expand Down
2 changes: 1 addition & 1 deletion splitio/commitversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ This file is created automatically, please do not edit
*/

// CommitVersion is the version of the last commit previous to release
const CommitVersion = "76010ef"
const CommitVersion = "3d3bf05"
27 changes: 8 additions & 19 deletions splitio/proxy/caching/caching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,20 @@ import (
"testing"

"github.com/splitio/go-split-commons/v5/dtos"
"github.com/splitio/go-toolkit/v5/testhelpers"
"github.com/stretchr/testify/assert"
)

func TestSegment(t *testing.T) {

if MakeSurrogateForSegmentChanges("segment1") != segmentPrefix+"segment1" {
t.Error("wrong segment changes surrogate.")
}
func TestSegmentSurrogates(t *testing.T) {
assert.Equal(t, segmentPrefix+"segment1", MakeSurrogateForSegmentChanges("segment1"))
assert.NotEqual(t, MakeSurrogateForSegmentChanges("segment1"), MakeSurrogateForSegmentChanges("segment2"))
}

func TestMySegmentKeyGeneration(t *testing.T) {
entries := MakeMySegmentsEntries("k1")
if entries[0] != "/api/mySegments/k1" {
t.Error("invalid mySegments cache entry")
}
if entries[1] != "gzip::/api/mySegments/k1" {
t.Error("invalid mySegments cache entry")
}
assert.Equal(t, "/api/mySegments/k1", entries[0])
assert.Equal(t, "gzip::/api/mySegments/k1", entries[1])
}

func TestMySegments(t *testing.T) {
testhelpers.AssertStringSliceEquals(
t,
MakeSurrogateForMySegments([]dtos.MySegmentDTO{{Name: "segment1"}, {Name: "segment2"}}),
[]string{},
"wrong my segments surrogate keys",
)
func TestMySegmentsSurrogates(t *testing.T) {
assert.Equal(t, []string(nil), MakeSurrogateForMySegments([]dtos.MySegmentDTO{{Name: "segment1"}, {Name: "segment2"}}))
}
Loading

0 comments on commit 5b22e14

Please sign in to comment.