mirror of
https://github.com/kemko/reproxy.git
synced 2026-01-01 15:55:49 +03:00
fix flaky tests
This commit is contained in:
@@ -252,6 +252,9 @@ func (s *Service) Mappers() (mappers []URLMapper) {
|
||||
for _, m := range s.mappers {
|
||||
mappers = append(mappers, m...)
|
||||
}
|
||||
sort.Slice(mappers, func(i, j int) bool {
|
||||
return mappers[i].ProviderID < mappers[j].ProviderID
|
||||
})
|
||||
return mappers
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ func TestHttp_DoWithAssets(t *testing.T) {
|
||||
cc := NewCacheControl(time.Hour * 12)
|
||||
h := Http{Timeouts: Timeouts{ResponseHeader: 200 * time.Millisecond}, Address: fmt.Sprintf("127.0.0.1:%d", port),
|
||||
AccessLog: io.Discard, AssetsWebRoot: "/static", AssetsLocation: "testdata", CacheControl: cc, Reporter: &ErrorReporter{Nice: false}}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 1000*time.Millisecond)
|
||||
defer cancel()
|
||||
|
||||
ds := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -136,7 +136,7 @@ func TestHttp_DoWithAssets(t *testing.T) {
|
||||
go func() {
|
||||
_ = h.Run(ctx)
|
||||
}()
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
client := http.Client{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user