Skip to content

Commit

Permalink
fix: creating new FrontingContext for each test
Browse files Browse the repository at this point in the history
  • Loading branch information
WendelHime committed Oct 28, 2024
1 parent 22c7e1d commit 59aaab8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fronted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,8 @@ func TestCustomValidators(t *testing.T) {
sadCloudCodes := []int{http.StatusPaymentRequired, http.StatusTeapot, http.StatusBadGateway}
sadCloudValidator := NewStatusCodeValidator(sadCloudCodes)
testURL := "https://abc.forbidden.com/quux"
testContext := NewFrontingContext("TestCustomValidators")

setup := func(validator ResponseValidator) {
setup := func(ctx *FrontingContext, validator ResponseValidator) {
masq := []*Masquerade{{Domain: "example.com", IpAddress: sadCloudAddr}}
alias := map[string]string{
"abc.forbidden.com": "abc.sadcloud.io",
Expand All @@ -553,7 +552,7 @@ func TestCustomValidators(t *testing.T) {
"sadcloud": p,
}

testContext.Configure(certs, providers, "sadcloud", "")
ctx.Configure(certs, providers, "sadcloud", "")
}

// This error indicates that the validator has discarded all masquerades.
Expand Down Expand Up @@ -634,7 +633,8 @@ func TestCustomValidators(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
setup(test.validator)
testContext := NewFrontingContext(test.name)
setup(testContext, test.validator)
direct, ok := testContext.NewFronted(30 * time.Second)
require.True(t, ok)
client := &http.Client{
Expand Down

0 comments on commit 59aaab8

Please sign in to comment.