Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelreiswildlife committed Sep 25, 2023
1 parent 82ed7ad commit 6bca41d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
5 changes: 4 additions & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ extensions:

enrichment:
webhook_urls:
ttl: 24h
cache:
ttl: 24h
addrs: "localhost:6739"
username: ""
webhook_timeout: 500ms
cloud_save:
url:
Expand Down
4 changes: 4 additions & 0 deletions config/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ enrichment:
webhook_urls:
dummy_tenant_id: "localhost:8080/"
webhook_timeout: 500ms
cache:
ttl: 24h
addrs: "localhost:6739"
username: ""
cloud_save:
url: "localhost:8888/"
disabled:
31 changes: 21 additions & 10 deletions leaderboard/enriching/enricher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
. "github.com/onsi/gomega"
mock_enriching "github.com/topfreegames/podium/leaderboard/v2/mocks"
"github.com/topfreegames/podium/leaderboard/v2/model"
"go.uber.org/zap"
"net/http"
"net/http/httptest"
)
Expand All @@ -32,7 +31,8 @@ var _ = Describe("Enricher tests", func() {
It("should not enrich if no webhook url is configured and cloud save service is disabled", func() {
cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))

enrich := NewEnricher(zap.NewNop(), cache,
enrich := NewEnricher(
cache,
WithCloudSaveDisabled(map[string]bool{tenantID: true}),
)

Expand Down Expand Up @@ -62,7 +62,10 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache, WithCloudSaveUrl(server.URL))
enrich := NewEnricher(
cache,
WithCloudSaveUrl(server.URL),
)

members := []*model.Member{
{
Expand Down Expand Up @@ -90,7 +93,10 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache, WithCloudSaveUrl(server.URL))
enrich := NewEnricher(
cache,
WithCloudSaveUrl(server.URL),
)

members := []*model.Member{
{
Expand Down Expand Up @@ -118,7 +124,10 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache, WithCloudSaveUrl(server.URL))
enrich := NewEnricher(
cache,
WithCloudSaveUrl(server.URL),
)

members := []*model.Member{
{
Expand Down Expand Up @@ -155,7 +164,7 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache,
enrich := NewEnricher(cache,
WithWebhookUrls(map[string]string{
tenantID: server.URL,
}),
Expand Down Expand Up @@ -187,7 +196,8 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache,
enrich := NewEnricher(
cache,
WithWebhookUrls(map[string]string{
tenantID: server.URL,
}),
Expand Down Expand Up @@ -217,7 +227,8 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache,
enrich := NewEnricher(
cache,
WithWebhookUrls(map[string]string{
tenantID: server.URL,
}),
Expand Down Expand Up @@ -254,7 +265,7 @@ var _ = Describe("Enricher tests", func() {

It("should return cached data if all members are cached", func() {
cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache)
enrich := NewEnricher(cache)

members := []*model.Member{
{
Expand Down Expand Up @@ -293,7 +304,7 @@ var _ = Describe("Enricher tests", func() {
})

cache := mock_enriching.NewMockEnricherCache(gomock.NewController(GinkgoT()))
enrich := NewEnricher(zap.NewNop(), cache,
enrich := NewEnricher(cache,
WithWebhookUrls(map[string]string{
tenantID: server.URL,
}),
Expand Down

0 comments on commit 6bca41d

Please sign in to comment.