Add a logger instance to bouncer instance (#134)

*  Add a logger instance to bouncer instance

* 🍱 fix test

* 🍱 fix lint

* 🍱 fix lint

* 🍱 fix lint

* 🍱 fix lint

* 🍱 fix lint

* 🍱 fix test

* 🍱 fix test

* 🍱 fix lint + test

* 🍱 fix test

* 🍱 fix test

* 🍱 fix test

* 🍱 fix lint

* 🍱 fix lint
This commit is contained in:
maxlerebourg
2024-02-11 11:52:47 +01:00
committed by GitHub
parent 6c183d9231
commit 575d3a02e5
7 changed files with 106 additions and 85 deletions
+5 -3
View File
@@ -4,12 +4,14 @@ package cache
import (
"testing"
logger "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/logger"
)
func Test_GetDecision(t *testing.T) {
IPInCache := "10.0.0.10"
IPNotInCache := "10.0.0.20"
client := &Client{cache: &localCache{}}
client := &Client{cache: &localCache{}, log: logger.New("INFO")}
client.SetDecision(IPInCache, true, 10)
type args struct {
clientIP string
@@ -45,7 +47,7 @@ func Test_GetDecision(t *testing.T) {
}
func Test_SetDecision(t *testing.T) {
client := &Client{cache: &localCache{}}
client := &Client{cache: &localCache{}, log: logger.New("INFO")}
IPInCache := "10.0.0.11"
type args struct {
clientIP string
@@ -76,7 +78,7 @@ func Test_SetDecision(t *testing.T) {
func Test_DeleteDecision(t *testing.T) {
IPInCache := "10.0.0.12"
IPNotInCache := "10.0.0.22"
client := &Client{cache: &localCache{}}
client := &Client{cache: &localCache{}, log: logger.New("INFO")}
client.SetDecision(IPInCache, true, 10)
type args struct {
clientIP string