Merge branch v3.4 into master
This commit is contained in:
commit
289d6e5dca
195 changed files with 1963 additions and 892 deletions
|
|
@ -1,7 +1,6 @@
|
|||
package acme
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -47,7 +46,7 @@ func TestLocalStore_GetAccount(t *testing.T) {
|
|||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
s := NewLocalStore(test.filename, safe.NewPool(context.Background()))
|
||||
s := NewLocalStore(test.filename, safe.NewPool(t.Context()))
|
||||
|
||||
account, err := s.GetAccount("test")
|
||||
require.NoError(t, err)
|
||||
|
|
@ -60,7 +59,7 @@ func TestLocalStore_GetAccount(t *testing.T) {
|
|||
func TestLocalStore_SaveAccount(t *testing.T) {
|
||||
acmeFile := filepath.Join(t.TempDir(), "acme.json")
|
||||
|
||||
s := NewLocalStore(acmeFile, safe.NewPool(context.Background()))
|
||||
s := NewLocalStore(acmeFile, safe.NewPool(t.Context()))
|
||||
|
||||
email := "some@email.com"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package acme
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -181,7 +180,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
|
|||
resolvingDomains: test.resolvingDomains,
|
||||
}
|
||||
|
||||
domains := acmeProvider.getUncheckedDomains(context.Background(), test.domains, "default")
|
||||
domains := acmeProvider.getUncheckedDomains(t.Context(), test.domains, "default")
|
||||
assert.Len(t, domains, len(test.expectedDomains), "Unexpected domains.")
|
||||
})
|
||||
}
|
||||
|
|
@ -245,7 +244,7 @@ func TestProvider_sanitizeDomains(t *testing.T) {
|
|||
|
||||
acmeProvider := Provider{Configuration: &Configuration{DNSChallenge: test.dnsChallenge}}
|
||||
|
||||
domains, err := acmeProvider.sanitizeDomains(context.Background(), test.domains)
|
||||
domains, err := acmeProvider.sanitizeDomains(t.Context(), test.domains)
|
||||
|
||||
if len(test.expectedErr) > 0 {
|
||||
assert.EqualError(t, err, test.expectedErr, "Unexpected error.")
|
||||
|
|
@ -424,7 +423,7 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
domains := deleteUnnecessaryDomains(context.Background(), test.domains)
|
||||
domains := deleteUnnecessaryDomains(t.Context(), test.domains)
|
||||
assert.Equal(t, test.expectedDomains, domains, "unexpected domain")
|
||||
})
|
||||
}
|
||||
|
|
@ -497,7 +496,7 @@ func TestIsAccountMatchingCaServer(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
result := isAccountMatchingCaServer(context.Background(), test.accountURI, test.serverURI)
|
||||
result := isAccountMatchingCaServer(t.Context(), test.accountURI, test.serverURI)
|
||||
|
||||
assert.Equal(t, test.expected, result)
|
||||
})
|
||||
|
|
@ -574,7 +573,7 @@ func TestInitAccount(t *testing.T) {
|
|||
|
||||
acmeProvider := Provider{account: test.account, Configuration: &Configuration{Email: test.email, KeyType: test.keyType}}
|
||||
|
||||
actualAccount, err := acmeProvider.initAccount(context.Background())
|
||||
actualAccount, err := acmeProvider.initAccount(t.Context())
|
||||
assert.NoError(t, err, "Init account in error")
|
||||
assert.Equal(t, test.expectedAccount.Email, actualAccount.Email, "unexpected email account")
|
||||
assert.Equal(t, test.expectedAccount.KeyType, actualAccount.KeyType, "unexpected keyType account")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package aggregator
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -24,7 +23,7 @@ func TestProviderAggregator_Provide(t *testing.T) {
|
|||
|
||||
cfgCh := make(chan dynamic.Message)
|
||||
errCh := make(chan error)
|
||||
pool := safe.NewPool(context.Background())
|
||||
pool := safe.NewPool(t.Context())
|
||||
|
||||
t.Cleanup(pool.Stop)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package consulcatalog
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -323,7 +322,7 @@ func TestDefaultRule(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
configuration := p.buildConfiguration(context.Background(), test.items, nil)
|
||||
configuration := p.buildConfiguration(t.Context(), test.items, nil)
|
||||
|
||||
assert.Equal(t, test.expected, configuration)
|
||||
})
|
||||
|
|
@ -3602,7 +3601,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
test.items[i].Tags = tags
|
||||
}
|
||||
|
||||
configuration := p.buildConfiguration(context.Background(), test.items, &connectCert{
|
||||
configuration := p.buildConfiguration(t.Context(), test.items, &connectCert{
|
||||
root: []string{"root"},
|
||||
leaf: keyPair{
|
||||
cert: "cert",
|
||||
|
|
@ -4120,7 +4119,7 @@ func TestFilterHealthStatuses(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
configuration := p.buildConfiguration(context.Background(), test.items, nil)
|
||||
configuration := p.buildConfiguration(t.Context(), test.items, nil)
|
||||
|
||||
assert.Equal(t, test.expected, configuration)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -340,7 +340,6 @@ func (p *DynConfBuilder) getIPAddress(ctx context.Context, container dockerData)
|
|||
}
|
||||
|
||||
netNotFound = true
|
||||
logger.Warn().Msgf("Could not find network named %q for container %q. Maybe you're missing the project's prefix in the label?", container.ExtraConf.Network, container.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -382,6 +381,9 @@ func (p *DynConfBuilder) getIPAddress(ctx context.Context, container dockerData)
|
|||
return p.getIPAddress(ctx, containerParsed)
|
||||
}
|
||||
|
||||
if netNotFound {
|
||||
logger.Warn().Msgf("Could not find network named %q for container %q. Maybe you're missing the project's prefix in the label?", container.ExtraConf.Network, container.Name)
|
||||
}
|
||||
for _, network := range container.NetworkSettings.Networks {
|
||||
if netNotFound {
|
||||
logger.Warn().Msgf("Defaulting to first available network (%q) for container %q.", network, container.Name)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -421,7 +420,7 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
configuration := builder.build(context.Background(), test.containers)
|
||||
configuration := builder.build(t.Context(), test.containers)
|
||||
|
||||
assert.Equal(t, test.expected, configuration)
|
||||
})
|
||||
|
|
@ -3929,7 +3928,7 @@ func TestDynConfBuilder_build(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
configuration := builder.build(context.Background(), test.containers)
|
||||
configuration := builder.build(t.Context(), test.containers)
|
||||
|
||||
assert.Equal(t, test.expected, configuration)
|
||||
})
|
||||
|
|
@ -4101,7 +4100,7 @@ func TestDynConfBuilder_getIPPort_docker(t *testing.T) {
|
|||
UseBindPortIP: true,
|
||||
}, nil, false)
|
||||
|
||||
actualIP, actualPort, actualError := builder.getIPPort(context.Background(), dData, test.serverPort)
|
||||
actualIP, actualPort, actualError := builder.getIPPort(t.Context(), dData, test.serverPort)
|
||||
if test.expected.error {
|
||||
require.Error(t, actualError)
|
||||
} else {
|
||||
|
|
@ -4219,7 +4218,7 @@ func TestDynConfBuilder_getIPAddress_docker(t *testing.T) {
|
|||
|
||||
builder := NewDynConfBuilder(conf, nil, false)
|
||||
|
||||
actual := builder.getIPAddress(context.Background(), dData)
|
||||
actual := builder.getIPAddress(t.Context(), dData)
|
||||
assert.Equal(t, test.expected, actual)
|
||||
})
|
||||
}
|
||||
|
|
@ -4278,11 +4277,11 @@ func TestDynConfBuilder_getIPAddress_swarm(t *testing.T) {
|
|||
var p SwarmProvider
|
||||
require.NoError(t, p.Init())
|
||||
|
||||
dData, err := p.parseService(context.Background(), test.service, test.networks)
|
||||
dData, err := p.parseService(t.Context(), test.service, test.networks)
|
||||
require.NoError(t, err)
|
||||
|
||||
builder := NewDynConfBuilder(p.Shared, nil, false)
|
||||
actual := builder.getIPAddress(context.Background(), dData)
|
||||
actual := builder.getIPAddress(t.Context(), dData)
|
||||
assert.Equal(t, test.expected, actual)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -68,11 +67,11 @@ func TestListTasks(t *testing.T) {
|
|||
var p SwarmProvider
|
||||
require.NoError(t, p.Init())
|
||||
|
||||
dockerData, err := p.parseService(context.Background(), test.service, test.networks)
|
||||
dockerData, err := p.parseService(t.Context(), test.service, test.networks)
|
||||
require.NoError(t, err)
|
||||
|
||||
dockerClient := &fakeTasksClient{tasks: test.tasks}
|
||||
taskDockerData, _ := listTasks(context.Background(), dockerClient, test.service.ID, dockerData, test.networks, test.isGlobalSVC)
|
||||
taskDockerData, _ := listTasks(t.Context(), dockerClient, test.service.ID, dockerData, test.networks, test.isGlobalSVC)
|
||||
|
||||
if len(test.expectedTasks) != len(taskDockerData) {
|
||||
t.Errorf("expected tasks %v, got %v", test.expectedTasks, taskDockerData)
|
||||
|
|
@ -238,7 +237,7 @@ func TestSwarmProvider_listServices(t *testing.T) {
|
|||
var p SwarmProvider
|
||||
require.NoError(t, p.Init())
|
||||
|
||||
serviceDockerData, err := p.listServices(context.Background(), dockerClient)
|
||||
serviceDockerData, err := p.listServices(t.Context(), dockerClient)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Len(t, serviceDockerData, len(test.expectedServices))
|
||||
|
|
@ -357,11 +356,11 @@ func TestSwarmProvider_parseService_task(t *testing.T) {
|
|||
var p SwarmProvider
|
||||
require.NoError(t, p.Init())
|
||||
|
||||
dData, err := p.parseService(context.Background(), test.service, test.networks)
|
||||
dData, err := p.parseService(t.Context(), test.service, test.networks)
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, task := range test.tasks {
|
||||
taskDockerData := parseTasks(context.Background(), task, dData, test.networks, test.isGlobalSVC)
|
||||
taskDockerData := parseTasks(t.Context(), task, dData, test.networks, test.isGlobalSVC)
|
||||
expected := test.expected[task.ID]
|
||||
assert.Equal(t, expected.Name, taskDockerData.Name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
|
|
@ -101,7 +100,7 @@ func Test_getPort_swarm(t *testing.T) {
|
|||
var p SwarmProvider
|
||||
require.NoError(t, p.Init())
|
||||
|
||||
dData, err := p.parseService(context.Background(), test.service, test.networks)
|
||||
dData, err := p.parseService(t.Context(), test.service, test.networks)
|
||||
require.NoError(t, err)
|
||||
|
||||
actual := getPort(dData, test.serverPort)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package ecs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -390,7 +389,7 @@ func TestDefaultRule(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
configuration := p.buildConfiguration(context.Background(), test.instances)
|
||||
configuration := p.buildConfiguration(t.Context(), test.instances)
|
||||
|
||||
assert.Equal(t, test.expected, configuration)
|
||||
})
|
||||
|
|
@ -3491,7 +3490,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
configuration := p.buildConfiguration(context.Background(), test.containers)
|
||||
configuration := p.buildConfiguration(t.Context(), test.containers)
|
||||
|
||||
assert.Equal(t, test.expected, configuration)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package file
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -67,7 +66,7 @@ func TestTLSCertificateContent(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
provider := &Provider{}
|
||||
configuration, err := provider.loadFileConfig(context.Background(), fileConfig.Name(), true)
|
||||
configuration, err := provider.loadFileConfig(t.Context(), fileConfig.Name(), true)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, "CONTENT", configuration.TLS.Certificates[0].Certificate.CertFile.String())
|
||||
|
|
@ -92,7 +91,7 @@ func TestErrorWhenEmptyConfig(t *testing.T) {
|
|||
configChan := make(chan dynamic.Message)
|
||||
errorChan := make(chan struct{})
|
||||
go func() {
|
||||
err := provider.Provide(configChan, safe.NewPool(context.Background()))
|
||||
err := provider.Provide(configChan, safe.NewPool(t.Context()))
|
||||
assert.Error(t, err)
|
||||
close(errorChan)
|
||||
}()
|
||||
|
|
@ -116,7 +115,7 @@ func TestProvideWithoutWatch(t *testing.T) {
|
|||
provider.DebugLogGeneratedTemplate = true
|
||||
|
||||
go func() {
|
||||
err := provider.Provide(configChan, safe.NewPool(context.Background()))
|
||||
err := provider.Provide(configChan, safe.NewPool(t.Context()))
|
||||
assert.NoError(t, err)
|
||||
}()
|
||||
|
||||
|
|
@ -146,7 +145,7 @@ func TestProvideWithWatch(t *testing.T) {
|
|||
configChan := make(chan dynamic.Message)
|
||||
|
||||
go func() {
|
||||
err := provider.Provide(configChan, safe.NewPool(context.Background()))
|
||||
err := provider.Provide(configChan, safe.NewPool(t.Context()))
|
||||
assert.NoError(t, err)
|
||||
}()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package http
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
|
@ -235,7 +234,7 @@ func TestProvider_Provide(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
err = provider.Provide(configurationChan, safe.NewPool(context.Background()))
|
||||
err = provider.Provide(configurationChan, safe.NewPool(t.Context()))
|
||||
require.NoError(t, err)
|
||||
|
||||
timeout := time.After(time.Second)
|
||||
|
|
@ -269,7 +268,7 @@ func TestProvider_ProvideConfigurationOnlyOnceIfUnchanged(t *testing.T) {
|
|||
|
||||
configurationChan := make(chan dynamic.Message, 10)
|
||||
|
||||
err = provider.Provide(configurationChan, safe.NewPool(context.Background()))
|
||||
err = provider.Provide(configurationChan, safe.NewPool(t.Context()))
|
||||
require.NoError(t, err)
|
||||
|
||||
time.Sleep(time.Second)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -1677,7 +1676,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) {
|
|||
AllowEmptyServices: test.allowEmptyServices,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -5313,7 +5312,7 @@ func TestLoadIngressRoutes(t *testing.T) {
|
|||
AllowEmptyServices: test.allowEmptyServices,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -5389,7 +5388,7 @@ func TestLoadIngressRoutes_multipleEndpointAddresses(t *testing.T) {
|
|||
}
|
||||
|
||||
p := Provider{}
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
|
||||
service, ok := conf.HTTP.Services["default-test-route-6b204d94623b3df4370c"]
|
||||
require.True(t, ok)
|
||||
|
|
@ -5904,7 +5903,7 @@ func TestLoadIngressRouteUDPs(t *testing.T) {
|
|||
AllowEmptyServices: test.allowEmptyServices,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -7402,7 +7401,7 @@ func TestCrossNamespace(t *testing.T) {
|
|||
|
||||
p := Provider{AllowCrossNamespace: test.allowCrossNamespace}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -7672,7 +7671,7 @@ func TestExternalNameService(t *testing.T) {
|
|||
|
||||
p := Provider{AllowExternalNameServices: test.allowExternalNameService}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -7854,7 +7853,7 @@ func TestNativeLB(t *testing.T) {
|
|||
|
||||
p := Provider{}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -8122,7 +8121,7 @@ func TestNodePortLB(t *testing.T) {
|
|||
DisableClusterScopeResources: test.disableClusterScope,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -8634,7 +8633,7 @@ func TestGlobalNativeLB(t *testing.T) {
|
|||
|
||||
p := Provider{NativeLBByDefault: test.NativeLBByDefault}
|
||||
|
||||
conf := p.loadConfigurationFromCRD(context.Background(), client)
|
||||
conf := p.loadConfigurationFromCRD(t.Context(), client)
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ type ForwardingTimeouts struct {
|
|||
|
||||
// RootCA defines a reference to a Secret or a ConfigMap that holds a CA certificate.
|
||||
// If both a Secret and a ConfigMap reference are defined, the Secret reference takes precedence.
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.secret) && has(self.configMap)",message="RootCA cannot have both Secret and ConfigMap defined."
|
||||
// +kubebuilder:validation:XValidation:rule="!has(self.secret) || !has(self.configMap)",message="RootCA cannot have both Secret and ConfigMap defined."
|
||||
type RootCA struct {
|
||||
// Secret defines the name of a Secret that holds a CA certificate.
|
||||
// The referenced Secret must contain a certificate under either a tls.ca or a ca.crt key.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package gateway
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -75,14 +74,14 @@ func TestGatewayClassLabelSelector(t *testing.T) {
|
|||
client: client,
|
||||
}
|
||||
|
||||
_ = p.loadConfigurationFromGateways(context.Background())
|
||||
_ = p.loadConfigurationFromGateways(t.Context())
|
||||
|
||||
gw, err := gwClient.GatewayV1().Gateways("default").Get(context.Background(), "traefik-external", metav1.GetOptions{})
|
||||
gw, err := gwClient.GatewayV1().Gateways("default").Get(t.Context(), "traefik-external", metav1.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Empty(t, gw.Status.Addresses)
|
||||
|
||||
gw, err = gwClient.GatewayV1().Gateways("default").Get(context.Background(), "traefik-internal", metav1.GetOptions{})
|
||||
gw, err = gwClient.GatewayV1().Gateways("default").Get(t.Context(), "traefik-internal", metav1.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, gw.Status.Addresses, 1)
|
||||
require.NotNil(t, gw.Status.Addresses[0].Type)
|
||||
|
|
@ -2556,7 +2555,7 @@ func TestLoadHTTPRoutes(t *testing.T) {
|
|||
client: client,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -2983,7 +2982,7 @@ func TestLoadHTTPRoutes_backendExtensionRef(t *testing.T) {
|
|||
p.RegisterBackendFuncs(group, kind, backendFunc)
|
||||
}
|
||||
}
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -3269,7 +3268,7 @@ func TestLoadHTTPRoutes_filterExtensionRef(t *testing.T) {
|
|||
p.RegisterFilterFuncs(group, kind, filterFunc)
|
||||
}
|
||||
}
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -3561,7 +3560,7 @@ func TestLoadGRPCRoutes_filterExtensionRef(t *testing.T) {
|
|||
p.RegisterFilterFuncs(group, kind, filterFunc)
|
||||
}
|
||||
}
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -4463,7 +4462,7 @@ func TestLoadTCPRoutes(t *testing.T) {
|
|||
client: client,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -5742,7 +5741,7 @@ func TestLoadTLSRoutes(t *testing.T) {
|
|||
client: client,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -6798,7 +6797,7 @@ func TestLoadMixedRoutes(t *testing.T) {
|
|||
client: client,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -7134,7 +7133,7 @@ func TestLoadRoutesWithReferenceGrants(t *testing.T) {
|
|||
client: client,
|
||||
}
|
||||
|
||||
conf := p.loadConfigurationFromGateways(context.Background())
|
||||
conf := p.loadConfigurationFromGateways(t.Context())
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
}
|
||||
|
|
@ -8186,7 +8185,7 @@ func newGatewaySimpleClientSet(t *testing.T, objects ...runtime.Object) *gatefak
|
|||
continue
|
||||
}
|
||||
|
||||
_, err := client.GatewayV1().Gateways(gateway.Namespace).Create(context.Background(), gateway, metav1.CreateOptions{})
|
||||
_, err := client.GatewayV1().Gateways(gateway.Namespace).Create(t.Context(), gateway, metav1.CreateOptions{})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package ingress
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -249,7 +248,7 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
|
|||
assert.Fail(t, "expected to receive event for endpointslices")
|
||||
}
|
||||
|
||||
emptyEndpointSlice, err = kubeClient.DiscoveryV1().EndpointSlices("test").Get(context.TODO(), "empty-endpointslice", metav1.GetOptions{})
|
||||
emptyEndpointSlice, err = kubeClient.DiscoveryV1().EndpointSlices("test").Get(t.Context(), "empty-endpointslice", metav1.GetOptions{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// Update endpoint annotation and resource version (apparently not done by fake client itself)
|
||||
|
|
@ -257,7 +256,7 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
|
|||
// This reflects the behavior of kubernetes controllers which use endpoint annotations for leader election.
|
||||
emptyEndpointSlice.Annotations["test-annotation"] = "___"
|
||||
emptyEndpointSlice.ResourceVersion = "1245"
|
||||
_, err = kubeClient.DiscoveryV1().EndpointSlices("test").Update(context.TODO(), emptyEndpointSlice, metav1.UpdateOptions{})
|
||||
_, err = kubeClient.DiscoveryV1().EndpointSlices("test").Update(t.Context(), emptyEndpointSlice, metav1.UpdateOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
select {
|
||||
|
|
@ -269,12 +268,12 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
|
|||
case <-time.After(50 * time.Millisecond):
|
||||
}
|
||||
|
||||
filledEndpointSlice, err = kubeClient.DiscoveryV1().EndpointSlices("test").Get(context.TODO(), "filled-endpointslice", metav1.GetOptions{})
|
||||
filledEndpointSlice, err = kubeClient.DiscoveryV1().EndpointSlices("test").Get(t.Context(), "filled-endpointslice", metav1.GetOptions{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
filledEndpointSlice.Endpoints[0].Addresses[0] = "10.13.37.2"
|
||||
filledEndpointSlice.ResourceVersion = "1235"
|
||||
_, err = kubeClient.DiscoveryV1().EndpointSlices("test").Update(context.TODO(), filledEndpointSlice, metav1.UpdateOptions{})
|
||||
_, err = kubeClient.DiscoveryV1().EndpointSlices("test").Update(t.Context(), filledEndpointSlice, metav1.UpdateOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
select {
|
||||
|
|
@ -296,7 +295,7 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
|
|||
newPortNumber := int32(42)
|
||||
filledEndpointSlice.Ports[0].Port = &newPortNumber
|
||||
filledEndpointSlice.ResourceVersion = "1236"
|
||||
_, err = kubeClient.DiscoveryV1().EndpointSlices("test").Update(context.TODO(), filledEndpointSlice, metav1.UpdateOptions{})
|
||||
_, err = kubeClient.DiscoveryV1().EndpointSlices("test").Update(t.Context(), filledEndpointSlice, metav1.UpdateOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
select {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
kind: Ingress
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
name: ""
|
||||
namespace: testing
|
||||
|
||||
spec:
|
||||
rules:
|
||||
- host: traefik.tchouk
|
||||
http:
|
||||
paths:
|
||||
- path: /bar
|
||||
backend:
|
||||
resource:
|
||||
kind: Service
|
||||
name: service1
|
||||
pathType: Prefix
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
kind: Ingress
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
name: ""
|
||||
namespace: testing
|
||||
|
||||
spec:
|
||||
rules:
|
||||
- host: traefik.tchouk
|
||||
http:
|
||||
paths:
|
||||
- path: /bar
|
||||
backend: {}
|
||||
pathType: Prefix
|
||||
|
||||
|
|
@ -316,6 +316,17 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl
|
|||
}
|
||||
|
||||
for _, pa := range rule.HTTP.Paths {
|
||||
if pa.Backend.Resource != nil {
|
||||
// https://kubernetes.io/docs/concepts/services-networking/ingress/#resource-backend
|
||||
logger.Error().Msg("Resource backends are not supported")
|
||||
continue
|
||||
}
|
||||
|
||||
if pa.Backend.Service == nil {
|
||||
logger.Error().Msg("Missing service definition")
|
||||
continue
|
||||
}
|
||||
|
||||
service, err := p.loadService(client, ingress.Namespace, pa.Backend)
|
||||
if err != nil {
|
||||
logger.Error().
|
||||
|
|
@ -493,15 +504,6 @@ func (p *Provider) shouldProcessIngress(ingress *netv1.Ingress, ingressClasses [
|
|||
}
|
||||
|
||||
func (p *Provider) loadService(client Client, namespace string, backend netv1.IngressBackend) (*dynamic.Service, error) {
|
||||
if backend.Resource != nil {
|
||||
// https://kubernetes.io/docs/concepts/services-networking/ingress/#resource-backend
|
||||
return nil, errors.New("resource backends are not supported")
|
||||
}
|
||||
|
||||
if backend.Service == nil {
|
||||
return nil, errors.New("missing service definition")
|
||||
}
|
||||
|
||||
service, exists, err := client.GetService(namespace, backend.Service.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package ingress
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
|
|
@ -527,6 +526,28 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "Ingress with backend resource",
|
||||
allowEmptyServices: true,
|
||||
expected: &dynamic.Configuration{
|
||||
HTTP: &dynamic.HTTPConfiguration{
|
||||
Middlewares: map[string]*dynamic.Middleware{},
|
||||
Routers: map[string]*dynamic.Router{},
|
||||
Services: map[string]*dynamic.Service{},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "Ingress without backend",
|
||||
allowEmptyServices: true,
|
||||
expected: &dynamic.Configuration{
|
||||
HTTP: &dynamic.HTTPConfiguration{
|
||||
Middlewares: map[string]*dynamic.Middleware{},
|
||||
Routers: map[string]*dynamic.Router{},
|
||||
Services: map[string]*dynamic.Service{},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "Ingress with one service without endpoint",
|
||||
expected: &dynamic.Configuration{
|
||||
|
|
@ -1675,7 +1696,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
|
|||
DefaultRuleSyntax: test.defaultRuleSyntax,
|
||||
StrictPrefixMatching: test.strictPrefixMatching,
|
||||
}
|
||||
conf := p.loadConfigurationFromIngresses(context.Background(), clientMock)
|
||||
conf := p.loadConfigurationFromIngresses(t.Context(), clientMock)
|
||||
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
|
@ -1801,7 +1822,7 @@ func TestLoadConfigurationFromIngressesWithExternalNameServices(t *testing.T) {
|
|||
|
||||
p := Provider{IngressClass: test.ingressClass}
|
||||
p.AllowExternalNameServices = test.allowExternalNameServices
|
||||
conf := p.loadConfigurationFromIngresses(context.Background(), clientMock)
|
||||
conf := p.loadConfigurationFromIngresses(t.Context(), clientMock)
|
||||
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
|
@ -1851,7 +1872,7 @@ func TestLoadConfigurationFromIngressesWithNativeLB(t *testing.T) {
|
|||
clientMock := newClientMock(generateTestFilename(test.desc))
|
||||
|
||||
p := Provider{IngressClass: test.ingressClass}
|
||||
conf := p.loadConfigurationFromIngresses(context.Background(), clientMock)
|
||||
conf := p.loadConfigurationFromIngresses(t.Context(), clientMock)
|
||||
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
|
@ -1912,7 +1933,7 @@ func TestLoadConfigurationFromIngressesWithNodePortLB(t *testing.T) {
|
|||
clientMock := newClientMock(generateTestFilename(test.desc))
|
||||
|
||||
p := Provider{DisableClusterScopeResources: test.clusterScopeDisabled}
|
||||
conf := p.loadConfigurationFromIngresses(context.Background(), clientMock)
|
||||
conf := p.loadConfigurationFromIngresses(t.Context(), clientMock)
|
||||
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
|
@ -2084,7 +2105,7 @@ func TestGetCertificates(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
tlsConfigs := map[string]*tls.CertAndStores{}
|
||||
err := getCertificates(context.Background(), test.ingress, test.client, tlsConfigs)
|
||||
err := getCertificates(t.Context(), test.ingress, test.client, tlsConfigs)
|
||||
|
||||
if test.errResult != "" {
|
||||
assert.EqualError(t, err, test.errResult)
|
||||
|
|
@ -2170,7 +2191,7 @@ func TestLoadConfigurationFromIngressesWithNativeLBByDefault(t *testing.T) {
|
|||
IngressClass: test.ingressClass,
|
||||
NativeLBByDefault: true,
|
||||
}
|
||||
conf := p.loadConfigurationFromIngresses(context.Background(), clientMock)
|
||||
conf := p.loadConfigurationFromIngresses(t.Context(), clientMock)
|
||||
|
||||
assert.Equal(t, test.expected, conf)
|
||||
})
|
||||
|
|
@ -2270,9 +2291,9 @@ func TestIngressEndpointPublishedService(t *testing.T) {
|
|||
PublishedService: "default/published-service",
|
||||
},
|
||||
}
|
||||
p.loadConfigurationFromIngresses(context.Background(), client)
|
||||
p.loadConfigurationFromIngresses(t.Context(), client)
|
||||
|
||||
ingress, err := kubeClient.NetworkingV1().Ingresses(metav1.NamespaceDefault).Get(context.Background(), "foo", metav1.GetOptions{})
|
||||
ingress, err := kubeClient.NetworkingV1().Ingresses(metav1.NamespaceDefault).Get(t.Context(), "foo", metav1.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, test.expected, ingress.Status.LoadBalancer.Ingress)
|
||||
|
|
@ -2380,9 +2401,11 @@ func TestStrictPrefixMatchingRule(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
|
||||
muxer, err := traefikhttp.NewMuxer()
|
||||
parser, err := traefikhttp.NewSyntaxParser()
|
||||
require.NoError(t, err)
|
||||
|
||||
muxer := traefikhttp.NewMuxer(parser)
|
||||
|
||||
rule := buildStrictPrefixMatchingRule(tt.path)
|
||||
err = muxer.AddRoute(rule, "", 0, handler)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package kv
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -298,7 +297,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
"traefik/tls/certificates/1/stores/1": "foobar",
|
||||
}))
|
||||
|
||||
cfg, err := provider.buildConfiguration(context.Background())
|
||||
cfg, err := provider.buildConfiguration(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &dynamic.Configuration{
|
||||
|
|
@ -958,7 +957,7 @@ func Test_buildConfiguration_KV_error(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
cfg, err := provider.buildConfiguration(context.Background())
|
||||
cfg, err := provider.buildConfiguration(t.Context())
|
||||
require.Error(t, err)
|
||||
assert.Nil(t, cfg)
|
||||
}
|
||||
|
|
@ -977,7 +976,7 @@ func TestKvWatchTree(t *testing.T) {
|
|||
|
||||
configChan := make(chan dynamic.Message)
|
||||
go func() {
|
||||
err := provider.watchKv(context.Background(), configChan)
|
||||
err := provider.watchKv(t.Context(), configChan)
|
||||
require.NoError(t, err)
|
||||
}()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package nomad
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -251,8 +250,7 @@ func Test_defaultRule(t *testing.T) {
|
|||
err := p.Init()
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.TODO()
|
||||
config := p.buildConfig(ctx, test.items)
|
||||
config := p.buildConfig(t.Context(), test.items)
|
||||
require.Equal(t, test.expected, config)
|
||||
})
|
||||
}
|
||||
|
|
@ -3077,8 +3075,7 @@ func Test_buildConfig(t *testing.T) {
|
|||
err := p.Init()
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.TODO()
|
||||
c := p.buildConfig(ctx, test.items)
|
||||
c := p.buildConfig(t.Context(), test.items)
|
||||
require.Equal(t, test.expected, c)
|
||||
})
|
||||
}
|
||||
|
|
@ -3246,8 +3243,7 @@ func Test_buildConfigAllowEmptyServicesTrue(t *testing.T) {
|
|||
err := p.Init()
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.TODO()
|
||||
c := p.buildConfig(ctx, test.items)
|
||||
c := p.buildConfig(t.Context(), test.items)
|
||||
require.Equal(t, test.expected, c)
|
||||
})
|
||||
}
|
||||
|
|
@ -3379,8 +3375,7 @@ func Test_buildConfigAllowEmptyServicesFalseDefault(t *testing.T) {
|
|||
err := p.Init()
|
||||
require.NoError(t, err)
|
||||
|
||||
ctx := context.TODO()
|
||||
c := p.buildConfig(ctx, test.items)
|
||||
c := p.buildConfig(t.Context(), test.items)
|
||||
require.Equal(t, test.expected, c)
|
||||
})
|
||||
}
|
||||
|
|
@ -3428,8 +3423,8 @@ func Test_keepItem(t *testing.T) {
|
|||
p := new(Provider)
|
||||
p.SetDefaults()
|
||||
p.Constraints = test.constraints
|
||||
ctx := context.TODO()
|
||||
result := p.keepItem(ctx, test.i)
|
||||
|
||||
result := p.keepItem(t.Context(), test.i)
|
||||
require.Equal(t, test.exp, result)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package nomad
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
|
@ -170,7 +169,7 @@ func Test_getNomadServiceDataWithEmptyServices_GroupService_Scaling1(t *testing.
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 1)
|
||||
}
|
||||
|
|
@ -200,7 +199,7 @@ func Test_getNomadServiceDataWithEmptyServices_GroupService_Scaling0(t *testing.
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 1)
|
||||
}
|
||||
|
|
@ -230,7 +229,7 @@ func Test_getNomadServiceDataWithEmptyServices_GroupService_ScalingDisabled(t *t
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 1)
|
||||
}
|
||||
|
|
@ -260,7 +259,7 @@ func Test_getNomadServiceDataWithEmptyServices_GroupService_ScalingDisabled_Stop
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
// Should not be listed as job is stopped
|
||||
|
|
@ -294,7 +293,7 @@ func Test_getNomadServiceDataWithEmptyServices_GroupTaskService_Scaling1(t *test
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 2)
|
||||
}
|
||||
|
|
@ -326,7 +325,7 @@ func Test_getNomadServiceDataWithEmptyServices_GroupTaskService_Scaling0(t *test
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 2)
|
||||
}
|
||||
|
|
@ -356,7 +355,7 @@ func Test_getNomadServiceDataWithEmptyServices_TCP(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 1)
|
||||
}
|
||||
|
|
@ -386,7 +385,7 @@ func Test_getNomadServiceDataWithEmptyServices_UDP(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 1)
|
||||
}
|
||||
|
|
@ -416,7 +415,7 @@ func Test_getNomadServiceDataWithEmptyServices_ScalingEnabled_Stopped(t *testing
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(context.TODO())
|
||||
items, err := p.getNomadServiceDataWithEmptyServices(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
// Should not be listed as job is stopped
|
||||
|
|
@ -465,7 +464,7 @@ func Test_getNomadServiceData(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// make the query for services
|
||||
items, err := p.getNomadServiceData(context.TODO())
|
||||
items, err := p.getNomadServiceData(t.Context())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, items, 2)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package tailscale
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
@ -125,7 +124,7 @@ func TestProvider_findDomains(t *testing.T) {
|
|||
|
||||
p := Provider{ResolverName: "foo"}
|
||||
|
||||
got := p.findDomains(context.TODO(), test.config)
|
||||
got := p.findDomains(t.Context(), test.config)
|
||||
assert.Equal(t, test.want, got)
|
||||
})
|
||||
}
|
||||
|
|
@ -230,7 +229,7 @@ func Test_sanitizeDomains(t *testing.T) {
|
|||
t.Run(test.desc, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
got := sanitizeDomains(context.TODO(), test.domains)
|
||||
got := sanitizeDomains(t.Context(), test.domains)
|
||||
assert.Equal(t, test.want, got)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package traefik
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"os"
|
||||
|
|
@ -269,7 +268,7 @@ func Test_createConfiguration(t *testing.T) {
|
|||
|
||||
provider := Provider{staticCfg: test.staticCfg}
|
||||
|
||||
cfg := provider.createConfiguration(context.Background())
|
||||
cfg := provider.createConfiguration(t.Context())
|
||||
|
||||
filename := filepath.Join("fixtures", test.desc)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue