mirror of
https://github.com/umputun/reproxy.git
synced 2024-10-26 18:20:52 +03:00
fix flaky tests
This commit is contained in:
parent
935e492461
commit
d364904dd8
@ -252,6 +252,9 @@ func (s *Service) Mappers() (mappers []URLMapper) {
|
|||||||
for _, m := range s.mappers {
|
for _, m := range s.mappers {
|
||||||
mappers = append(mappers, m...)
|
mappers = append(mappers, m...)
|
||||||
}
|
}
|
||||||
|
sort.Slice(mappers, func(i, j int) bool {
|
||||||
|
return mappers[i].ProviderID < mappers[j].ProviderID
|
||||||
|
})
|
||||||
return mappers
|
return mappers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ func TestHttp_DoWithAssets(t *testing.T) {
|
|||||||
cc := NewCacheControl(time.Hour * 12)
|
cc := NewCacheControl(time.Hour * 12)
|
||||||
h := Http{Timeouts: Timeouts{ResponseHeader: 200 * time.Millisecond}, Address: fmt.Sprintf("127.0.0.1:%d", port),
|
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}}
|
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()
|
defer cancel()
|
||||||
|
|
||||||
ds := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
ds := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -136,7 +136,7 @@ func TestHttp_DoWithAssets(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
_ = h.Run(ctx)
|
_ = h.Run(ctx)
|
||||||
}()
|
}()
|
||||||
time.Sleep(10 * time.Millisecond)
|
time.Sleep(50 * time.Millisecond)
|
||||||
|
|
||||||
client := http.Client{}
|
client := http.Client{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user