Merge branch v3.0 into master

This commit is contained in:
Fernandez Ludovic 2024-04-03 20:30:13 +02:00
commit 1ffbffb26a
326 changed files with 8850 additions and 9322 deletions

View file

@ -34,11 +34,11 @@ func (s *ThrottlingSuite) TestThrottleConfReload() {
s.traefikCmd(withConfigFile("fixtures/throttling/simple.toml"))
// wait for Traefik
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1000*time.Millisecond, try.BodyContains("rest@internal"))
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", 5*time.Second, try.BodyContains("rest@internal"))
require.NoError(s.T(), err)
// Expected a 404 as we did not configure anything.
err = try.GetRequest("http://127.0.0.1:8000/", 1000*time.Millisecond, try.StatusCodeIs(http.StatusNotFound))
err = try.GetRequest("http://127.0.0.1:8000/", 2*time.Second, try.StatusCodeIs(http.StatusNotFound))
require.NoError(s.T(), err)
config := &dynamic.Configuration{
@ -67,7 +67,7 @@ func (s *ThrottlingSuite) TestThrottleConfReload() {
confChanges := 10
for i := 0; i < confChanges; i++ {
for i := range confChanges {
config.HTTP.Routers[fmt.Sprintf("routerHTTP%d", i)] = router
data, err := json.Marshal(config)
require.NoError(s.T(), err)

View file

@ -27,3 +27,4 @@
address = ":8443"
[providers.kubernetesGateway]
experimentalChannel = true

View file

@ -24,10 +24,12 @@
[tcp.routers.router1]
service = "service1"
rule = "HostSNI(`snitest.net`)"
[tcp.routers.router1.tls]
[tcp.routers.router2]
service = "service2"
rule = "HostSNI(`snitest.com`)"
[tcp.routers.router2.tls]
[tcp.services]
[tcp.services.service1]

View file

@ -15,6 +15,17 @@
[entryPoints.web]
address = ":8000"
# Adding metrics to confirm that there is no wrong interaction with tracing.
[metrics]
{{if .IsHTTP}}
[metrics.otlp.http]
endpoint = "http://{{.IP}}:4318"
{{else}}
[metrics.otlp.grpc]
endpoint = "{{.IP}}:4317"
insecure = true
{{end}}
[tracing]
servicename = "tracing"
sampleRate = 1.0

View file

@ -312,7 +312,7 @@ func (s *HealthCheckSuite) TestPropagate() {
// Verify load-balancing on root still works, and that we're getting an alternation between wsp2, and wsp4.
reachedServers := make(map[string]int)
for i := 0; i < 4; i++ {
for range 4 {
resp, err := client.Do(rootReq)
require.NoError(s.T(), err)
@ -352,7 +352,7 @@ func (s *HealthCheckSuite) TestPropagate() {
// Verify load-balancing on foo still works, and that we're getting wsp2, wsp2, wsp2, wsp2, etc.
want := `IP: ` + s.whoami2IP
for i := 0; i < 4; i++ {
for range 4 {
resp, err := client.Do(fooReq)
require.NoError(s.T(), err)
@ -368,7 +368,7 @@ func (s *HealthCheckSuite) TestPropagate() {
// Verify load-balancing on bar still works, and that we're getting wsp2, wsp2, wsp2, wsp2, etc.
want = `IP: ` + s.whoami2IP
for i := 0; i < 4; i++ {
for range 4 {
resp, err := client.Do(barReq)
require.NoError(s.T(), err)
@ -390,7 +390,7 @@ func (s *HealthCheckSuite) TestPropagate() {
try.Sleep(time.Second)
// Verify that everything is down, and that we get 503s everywhere.
for i := 0; i < 2; i++ {
for range 2 {
resp, err := client.Do(rootReq)
require.NoError(s.T(), err)
assert.Equal(s.T(), http.StatusServiceUnavailable, resp.StatusCode)
@ -417,7 +417,7 @@ func (s *HealthCheckSuite) TestPropagate() {
// Verify everything is up on root router.
reachedServers = make(map[string]int)
for i := 0; i < 4; i++ {
for range 4 {
resp, err := client.Do(rootReq)
require.NoError(s.T(), err)
@ -452,7 +452,7 @@ func (s *HealthCheckSuite) TestPropagate() {
// Verify everything is up on foo router.
reachedServers = make(map[string]int)
for i := 0; i < 4; i++ {
for range 4 {
resp, err := client.Do(fooReq)
require.NoError(s.T(), err)
@ -487,7 +487,7 @@ func (s *HealthCheckSuite) TestPropagate() {
// Verify everything is up on bar router.
reachedServers = make(map[string]int)
for i := 0; i < 4; i++ {
for range 4 {
resp, err := client.Do(barReq)
require.NoError(s.T(), err)

View file

@ -1134,8 +1134,6 @@ func (s *HTTPSSuite) TestWithDomainFronting() {
}
for _, test := range testCases {
test := test
req, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:4443", nil)
require.NoError(s.T(), err)
req.Host = test.hostHeader
@ -1179,8 +1177,6 @@ func (s *HTTPSSuite) TestWithInvalidTLSOption() {
}
for _, test := range testCases {
test := test
tlsConfig := &tls.Config{
InsecureSkipVerify: true,
}

View file

@ -243,7 +243,7 @@ func (s *BaseSuite) createComposeProject(name string) {
}
if containerConfig.Deploy.Replicas > 0 {
for i := 0; i < containerConfig.Deploy.Replicas; i++ {
for i := range containerConfig.Deploy.Replicas {
id = fmt.Sprintf("%s-%d", id, i+1)
con, err := s.createContainer(ctx, containerConfig, id, mounts)
require.NoError(s.T(), err)

View file

@ -311,7 +311,7 @@ func (s *SimpleSuite) TestMetricsPrometheusTwoRoutersOneService() {
require.NoError(s.T(), err)
// adding a loop to test if metrics are not deleted
for i := 0; i < 10; i++ {
for range 10 {
request, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8080/metrics", nil)
require.NoError(s.T(), err)
@ -876,7 +876,7 @@ func (s *SimpleSuite) TestWRR() {
require.NoError(s.T(), err)
repartition := map[string]int{}
for i := 0; i < 4; i++ {
for range 4 {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil)
require.NoError(s.T(), err)
@ -922,7 +922,7 @@ func (s *SimpleSuite) TestWRRSticky() {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil)
require.NoError(s.T(), err)
for i := 0; i < 4; i++ {
for range 4 {
response, err := http.DefaultClient.Do(req)
require.NoError(s.T(), err)
assert.Equal(s.T(), http.StatusOK, response.StatusCode)
@ -978,7 +978,7 @@ func (s *SimpleSuite) TestMirror() {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil)
require.NoError(s.T(), err)
for i := 0; i < 10; i++ {
for range 10 {
response, err := http.DefaultClient.Do(req)
require.NoError(s.T(), err)
assert.Equal(s.T(), http.StatusOK, response.StatusCode)
@ -1049,7 +1049,7 @@ func (s *SimpleSuite) TestMirrorWithBody() {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", bytes.NewBuffer(body20))
require.NoError(s.T(), err)
req.Header.Set("Size", "20")
for i := 0; i < 10; i++ {
for range 10 {
response, err := http.DefaultClient.Do(req)
require.NoError(s.T(), err)
assert.Equal(s.T(), http.StatusOK, response.StatusCode)
@ -1070,7 +1070,7 @@ func (s *SimpleSuite) TestMirrorWithBody() {
req, err = http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoamiWithMaxBody", bytes.NewBuffer(body5))
require.NoError(s.T(), err)
req.Header.Set("Size", "5")
for i := 0; i < 10; i++ {
for range 10 {
response, err := http.DefaultClient.Do(req)
require.NoError(s.T(), err)
assert.Equal(s.T(), http.StatusOK, response.StatusCode)
@ -1091,7 +1091,7 @@ func (s *SimpleSuite) TestMirrorWithBody() {
req, err = http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoamiWithMaxBody", bytes.NewBuffer(body20))
require.NoError(s.T(), err)
req.Header.Set("Size", "20")
for i := 0; i < 10; i++ {
for range 10 {
response, err := http.DefaultClient.Do(req)
require.NoError(s.T(), err)
assert.Equal(s.T(), http.StatusOK, response.StatusCode)
@ -1137,7 +1137,7 @@ func (s *SimpleSuite) TestMirrorCanceled() {
err := try.GetRequest("http://127.0.0.1:8080/api/http/services", 1000*time.Millisecond, try.BodyContains("mirror1", "mirror2", "service1"))
require.NoError(s.T(), err)
for i := 0; i < 5; i++ {
for range 5 {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil)
require.NoError(s.T(), err)

View file

@ -287,7 +287,7 @@ func (s *TCPSuite) TestWRR() {
require.NoError(s.T(), err)
call := map[string]int{}
for i := 0; i < 4; i++ {
for range 4 {
// Traefik passes through, termination handled by whoami-b or whoami-bb
out, err := guessWhoTLSPassthrough("127.0.0.1:8093", "whoami-b.test")
require.NoError(s.T(), err)

View file

@ -53,7 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -69,7 +69,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -53,7 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -69,7 +69,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -6,7 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -22,7 +22,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -6,7 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -22,7 +22,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -6,7 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -22,7 +22,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -6,7 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -22,7 +22,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"
@ -71,4 +71,4 @@
"status": "enabled"
}
}
}
}

View file

@ -6,7 +6,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -22,7 +22,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -53,7 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -69,7 +69,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -53,7 +53,7 @@
],
"service": "api@internal",
"rule": "PathPrefix(`/api`)",
"priority": 2147483646,
"priority": 9223372036854775806,
"status": "enabled",
"using": [
"traefik"
@ -69,7 +69,7 @@
],
"service": "dashboard@internal",
"rule": "PathPrefix(`/`)",
"priority": 2147483645,
"priority": 9223372036854775805,
"status": "enabled",
"using": [
"traefik"

View file

@ -302,7 +302,7 @@ func (s *TracingSuite) TestOpentelemetryRetry() {
s.traefikCmd(withConfigFile(file))
// wait for traefik
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("basic-auth"))
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", 2*time.Second, try.BodyContains("basic-auth"))
require.NoError(s.T(), err)
err = try.GetRequest("http://127.0.0.1:8000/retry", 500*time.Millisecond, try.StatusCodeIs(http.StatusBadGateway))
@ -425,7 +425,7 @@ func (s *TracingSuite) TestNoInternals() {
s.traefikCmd(withConfigFile(file))
// wait for traefik
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("basic-auth"))
err := try.GetRequest("http://127.0.0.1:8080/api/rawdata", 2*time.Second, try.BodyContains("basic-auth"))
require.NoError(s.T(), err)
err = try.GetRequest("http://127.0.0.1:8000/ratelimit", 500*time.Millisecond, try.StatusCodeIs(http.StatusOK))

View file

@ -82,7 +82,7 @@ func (s *UDPSuite) TestWRR() {
stop := make(chan struct{})
go func() {
call := map[string]int{}
for i := 0; i < 8; i++ {
for range 8 {
out, err := guessWhoUDP("127.0.0.1:8093")
require.NoError(s.T(), err)
switch {