mirror of
https://github.com/foomo/contentfulproxy.git
synced 2025-10-16 12:25:37 +00:00
style: format code
This commit is contained in:
parent
51b33b1006
commit
49b59ea987
@ -33,7 +33,6 @@ func main() {
|
||||
webserverPath := config.DefaultWebserverPath(c)
|
||||
backendURL := config.DefaultBackendURL(c)
|
||||
|
||||
|
||||
// create proxy
|
||||
proxy, _ := proxy.NewProxy(
|
||||
context.Background(),
|
||||
|
||||
@ -3,9 +3,9 @@ package log
|
||||
import "go.uber.org/zap"
|
||||
|
||||
const (
|
||||
ServiceRoutineKey = "service_routine"
|
||||
CacheIdKey = "cache_id"
|
||||
URLKey = "url"
|
||||
ServiceRoutineKey = "service_routine"
|
||||
CacheIdKey = "cache_id"
|
||||
URLKey = "url"
|
||||
NumberOfWaitingClientsKey = "num_waiting_clients"
|
||||
)
|
||||
|
||||
|
||||
@ -3,13 +3,14 @@ package proxy
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"github.com/foomo/contentfulproxy/packages/go/log"
|
||||
"go.uber.org/zap"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/foomo/contentfulproxy/packages/go/log"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type cacheID string
|
||||
|
||||
@ -3,9 +3,10 @@ package proxy
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"github.com/foomo/contentfulproxy/packages/go/log"
|
||||
"net/http"
|
||||
|
||||
|
||||
"github.com/foomo/contentfulproxy/packages/go/log"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
||||
@ -2,21 +2,22 @@ package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/zap"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const (
|
||||
responseFoo = `i am a foo response`
|
||||
responseBar = `i am bar response`
|
||||
responseFoo = `i am a foo response`
|
||||
responseBar = `i am bar response`
|
||||
responseUpdate = `update`
|
||||
responseFlush = `update`
|
||||
responseFlush = `update`
|
||||
)
|
||||
|
||||
type getStats func(path string) int
|
||||
@ -82,7 +83,6 @@ func GetWebHook(t *testing.T) (getStats, http.HandlerFunc) {
|
||||
}
|
||||
|
||||
func getTestServer(t *testing.T) (gs func(path string) int, ws func(path string) int, s *httptest.Server) {
|
||||
|
||||
l, _ := zap.NewProduction()
|
||||
|
||||
gs, backendHandler := GetBackend(t)
|
||||
@ -93,8 +93,8 @@ func getTestServer(t *testing.T) (gs func(path string) int, ws func(path string)
|
||||
p, _ := NewProxy(
|
||||
context.Background(),
|
||||
l,
|
||||
func() string {return backendServer.URL},
|
||||
func() string {return ""},
|
||||
func() string { return backendServer.URL },
|
||||
func() string { return "" },
|
||||
func() []string {
|
||||
return []string{
|
||||
webHookServer.URL + "/test1",
|
||||
@ -105,7 +105,6 @@ func getTestServer(t *testing.T) (gs func(path string) int, ws func(path string)
|
||||
s = httptest.NewServer(p)
|
||||
t.Log("we have a proxy in front of it running on", s.URL)
|
||||
return gs, ws, s
|
||||
|
||||
}
|
||||
|
||||
func TestProxy(t *testing.T) {
|
||||
@ -132,10 +131,9 @@ func TestProxy(t *testing.T) {
|
||||
}
|
||||
assert.Equal(t, 1, gs("/foo"))
|
||||
|
||||
|
||||
// check the current status
|
||||
//response, err := http.Get(server.URL + "/info")
|
||||
//assert.NoError(t, err)
|
||||
// response, err := http.Get(server.URL + "/info")
|
||||
// assert.NoError(t, err)
|
||||
|
||||
//
|
||||
_, _ = http.Get(server.URL + "/update")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user