This commit is contained in:
Josh Soref 2020-11-27 12:26:53 -05:00
parent fe65e9d22f
commit a8728f3d2c
38 changed files with 1120 additions and 1120 deletions

View file

@ -147,7 +147,7 @@ func TestIngressAuth(t *testing.T) {
i, err := NewParser(dir, &mockSecret{}).Parse(ing)
if err != nil {
t.Errorf("Uxpected error with ingress: %v", err)
t.Errorf("Unexpected error with ingress: %v", err)
}
auth, ok := i.(*Config)
if !ok {

View file

@ -97,7 +97,7 @@ func TestAnnotations(t *testing.T) {
fakeSecret := &mockSecret{}
i, err := NewParser(fakeSecret).Parse(ing)
if err != nil {
t.Errorf("Uxpected error with ingress: %v", err)
t.Errorf("Unexpected error with ingress: %v", err)
}
u, ok := i.(*Config)
@ -163,7 +163,7 @@ func TestInvalidAnnotations(t *testing.T) {
i, err := NewParser(fakeSecret).Parse(ing)
if err != nil {
t.Errorf("Uxpected error with ingress: %v", err)
t.Errorf("Unexpected error with ingress: %v", err)
}
u, ok := i.(*Config)
if !ok {

View file

@ -100,7 +100,7 @@ func TestAnnotations(t *testing.T) {
fakeSecret := &mockSecret{}
i, err := NewParser(fakeSecret).Parse(ing)
if err != nil {
t.Errorf("Uxpected error with ingress: %v", err)
t.Errorf("Unexpected error with ingress: %v", err)
}
u, ok := i.(*Config)
@ -175,7 +175,7 @@ func TestInvalidAnnotations(t *testing.T) {
i, err := NewParser(fakeSecret).Parse(ing)
if err != nil {
t.Errorf("Uxpected error with ingress: %v", err)
t.Errorf("Unexpected error with ingress: %v", err)
}
u, ok := i.(*Config)
if !ok {

View file

@ -134,28 +134,28 @@ func TestRateLimiting(t *testing.T) {
t.Errorf("expected a RateLimit type")
}
if rateLimit.Connections.Limit != 5 {
t.Errorf("expected 5 in limit by ip but %v was returend", rateLimit.Connections)
t.Errorf("expected 5 in limit by ip but %v was returned", rateLimit.Connections)
}
if rateLimit.Connections.Burst != 5*5 {
t.Errorf("expected %d in burst limit by ip but %v was returend", 5*3, rateLimit.Connections)
t.Errorf("expected %d in burst limit by ip but %v was returned", 5*3, rateLimit.Connections)
}
if rateLimit.RPS.Limit != 100 {
t.Errorf("expected 100 in limit by rps but %v was returend", rateLimit.RPS)
t.Errorf("expected 100 in limit by rps but %v was returned", rateLimit.RPS)
}
if rateLimit.RPS.Burst != 100*5 {
t.Errorf("expected %d in burst limit by rps but %v was returend", 100*3, rateLimit.RPS)
t.Errorf("expected %d in burst limit by rps but %v was returned", 100*3, rateLimit.RPS)
}
if rateLimit.RPM.Limit != 10 {
t.Errorf("expected 10 in limit by rpm but %v was returend", rateLimit.RPM)
t.Errorf("expected 10 in limit by rpm but %v was returned", rateLimit.RPM)
}
if rateLimit.RPM.Burst != 10*5 {
t.Errorf("expected %d in burst limit by rpm but %v was returend", 10*3, rateLimit.RPM)
t.Errorf("expected %d in burst limit by rpm but %v was returned", 10*3, rateLimit.RPM)
}
if rateLimit.LimitRateAfter != 100 {
t.Errorf("expected 100 in limit by limitrateafter but %v was returend", rateLimit.LimitRateAfter)
t.Errorf("expected 100 in limit by limitrateafter but %v was returned", rateLimit.LimitRateAfter)
}
if rateLimit.LimitRate != 10 {
t.Errorf("expected 10 in limit by limitrate but %v was returend", rateLimit.LimitRate)
t.Errorf("expected 10 in limit by limitrate but %v was returned", rateLimit.LimitRate)
}
data = map[string]string{}
@ -177,27 +177,27 @@ func TestRateLimiting(t *testing.T) {
t.Errorf("expected a RateLimit type")
}
if rateLimit.Connections.Limit != 5 {
t.Errorf("expected 5 in limit by ip but %v was returend", rateLimit.Connections)
t.Errorf("expected 5 in limit by ip but %v was returned", rateLimit.Connections)
}
if rateLimit.Connections.Burst != 5*3 {
t.Errorf("expected %d in burst limit by ip but %v was returend", 5*3, rateLimit.Connections)
t.Errorf("expected %d in burst limit by ip but %v was returned", 5*3, rateLimit.Connections)
}
if rateLimit.RPS.Limit != 100 {
t.Errorf("expected 100 in limit by rps but %v was returend", rateLimit.RPS)
t.Errorf("expected 100 in limit by rps but %v was returned", rateLimit.RPS)
}
if rateLimit.RPS.Burst != 100*3 {
t.Errorf("expected %d in burst limit by rps but %v was returend", 100*3, rateLimit.RPS)
t.Errorf("expected %d in burst limit by rps but %v was returned", 100*3, rateLimit.RPS)
}
if rateLimit.RPM.Limit != 10 {
t.Errorf("expected 10 in limit by rpm but %v was returend", rateLimit.RPM)
t.Errorf("expected 10 in limit by rpm but %v was returned", rateLimit.RPM)
}
if rateLimit.RPM.Burst != 10*3 {
t.Errorf("expected %d in burst limit by rpm but %v was returend", 10*3, rateLimit.RPM)
t.Errorf("expected %d in burst limit by rpm but %v was returned", 10*3, rateLimit.RPM)
}
if rateLimit.LimitRateAfter != 100 {
t.Errorf("expected 100 in limit by limitrateafter but %v was returend", rateLimit.LimitRateAfter)
t.Errorf("expected 100 in limit by limitrateafter but %v was returned", rateLimit.LimitRateAfter)
}
if rateLimit.LimitRate != 10 {
t.Errorf("expected 10 in limit by limitrate but %v was returend", rateLimit.LimitRate)
t.Errorf("expected 10 in limit by limitrate but %v was returned", rateLimit.LimitRate)
}
}

View file

@ -42,7 +42,7 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation {
// rule used to indicate if the upstream servers should use SSL
func (a su) Parse(ing *networking.Ingress) (secure interface{}, err error) {
if ca, _ := parser.GetStringAnnotation("secure-verify-ca-secret", ing); ca != "" {
klog.Warningf("NOTE! secure-verify-ca-secret is not suppored anymore. Please use proxy-ssl-secret instead")
klog.Warningf("NOTE! secure-verify-ca-secret is not supported anymore. Please use proxy-ssl-secret instead")
}
return
}

View file

@ -154,7 +154,7 @@ func (a affinity) Parse(ing *networking.Ingress) (interface{}, error) {
at = ""
}
// Check the afinity mode that will be used
// Check the affinity mode that will be used
am, err := parser.GetStringAnnotation(annotationAffinityMode, ing)
if err != nil {
am = ""

View file

@ -301,7 +301,7 @@ func (n *NGINXController) getStreamServices(configmapName string, proto apiv1.Pr
nginx.StreamPort,
}
reserverdPorts := sets.NewInt(rp...)
reservedPorts := sets.NewInt(rp...)
// svcRef format: <(str)namespace>/<(str)service>:<(intstr)port>[:<("PROXY")decode>:<("PROXY")encode>]
for port, svcRef := range configmap.Data {
externalPort, err := strconv.Atoi(port) // #nosec
@ -309,7 +309,7 @@ func (n *NGINXController) getStreamServices(configmapName string, proto apiv1.Pr
klog.Warningf("%q is not a valid %v port number", port, proto)
continue
}
if reserverdPorts.Has(externalPort) {
if reservedPorts.Has(externalPort) {
klog.Warningf("Port %d cannot be used for %v stream services. It is reserved for the Ingress controller.", externalPort, proto)
continue
}
@ -1451,7 +1451,7 @@ func extractTLSSecretName(host string, ing *ingress.Ingress,
return ""
}
// getRemovedHosts returns a list of the hostsnames
// getRemovedHosts returns a list of the hostnames
// that are not associated anymore to the NGINX configuration.
func getRemovedHosts(rucfg, newcfg *ingress.Configuration) []string {
old := sets.NewString()

View file

@ -1404,7 +1404,7 @@ func TestGetBackendServers(t *testing.T) {
}
if upstreams[0].Name != "example-http-svc-1-80" {
t.Errorf("example-http-svc-1-80 should be frist upstream, got %s", upstreams[0].Name)
t.Errorf("example-http-svc-1-80 should be first upstream, got %s", upstreams[0].Name)
return
}
if upstreams[0].NoServer {

View file

@ -86,7 +86,7 @@ var (
true,
false,
},
"when secure backend, stickeness and dynamic config enabled": {
"when secure backend, stickiness and dynamic config enabled": {
"/",
"/",
"/",
@ -874,10 +874,10 @@ func TestEscapeLiteralDollar(t *testing.T) {
t.Errorf("Expected %v but returned %v", expected, escapedPath)
}
leaveUnchagned := "/leave-me/unchagned"
escapedPath = escapeLiteralDollar(leaveUnchagned)
if escapedPath != leaveUnchagned {
t.Errorf("Expected %v but returned %v", leaveUnchagned, escapedPath)
leaveUnchanged := "/leave-me/unchanged"
escapedPath = escapeLiteralDollar(leaveUnchanged)
if escapedPath != leaveUnchanged {
t.Errorf("Expected %v but returned %v", leaveUnchanged, escapedPath)
}
escapedPath = escapeLiteralDollar(false)

View file

@ -32,8 +32,8 @@ type scrapeRequest struct {
done chan struct{}
}
// Stopable defines a prometheus collector that can be stopped
type Stopable interface {
// Stoppable defines a prometheus collector that can be stopped
type Stoppable interface {
prometheus.Collector
Stop()
}

View file

@ -63,7 +63,7 @@ func buildSimpleClientSet() *testclient.Clientset {
Name: "foo1",
Namespace: apiv1.NamespaceDefault,
Labels: map[string]string{
"lable_sig": "foo_pod",
"label_sig": "foo_pod",
},
},
Spec: apiv1.PodSpec{
@ -96,7 +96,7 @@ func buildSimpleClientSet() *testclient.Clientset {
Name: "foo2",
Namespace: apiv1.NamespaceDefault,
Labels: map[string]string{
"lable_sig": "foo_no",
"label_sig": "foo_no",
},
},
},
@ -105,7 +105,7 @@ func buildSimpleClientSet() *testclient.Clientset {
Name: "foo3",
Namespace: metav1.NamespaceSystem,
Labels: map[string]string{
"lable_sig": "foo_pod",
"label_sig": "foo_pod",
},
},
Spec: apiv1.PodSpec{
@ -301,7 +301,7 @@ func TestStatusActions(t *testing.T) {
Name: "foo_base_pod",
Namespace: apiv1.NamespaceDefault,
Labels: map[string]string{
"lable_sig": "foo_pod",
"label_sig": "foo_pod",
},
},
}
@ -379,7 +379,7 @@ func TestKeyfunc(t *testing.T) {
}
}
func TestRunningAddresessWithPublishService(t *testing.T) {
func TestRunningAddressesWithPublishService(t *testing.T) {
testCases := map[string]struct {
fakeClient *testclient.Clientset
expected []string
@ -559,7 +559,7 @@ func TestRunningAddresessWithPublishService(t *testing.T) {
}
}
func TestRunningAddresessWithPods(t *testing.T) {
func TestRunningAddressesWithPods(t *testing.T) {
fk := buildStatusSync()
fk.PublishService = ""
@ -577,7 +577,7 @@ func TestRunningAddresessWithPods(t *testing.T) {
}
}
func TestRunningAddresessWithPublishStatusAddress(t *testing.T) {
func TestRunningAddressesWithPublishStatusAddress(t *testing.T) {
fk := buildStatusSync()
fk.PublishStatusAddress = "127.0.0.1"

View file

@ -86,7 +86,7 @@ type Backend struct {
SSLPassthrough bool `json:"sslPassthrough"`
// Endpoints contains the list of endpoints currently running
Endpoints []Endpoint `json:"endpoints,omitempty"`
// StickySessionAffinitySession contains the StickyConfig object with stickyness configuration
// StickySessionAffinitySession contains the StickyConfig object with stickiness configuration
SessionAffinity SessionAffinityConfig `json:"sessionAffinityConfig"`
// Consistent hashing by NGINX variable
UpstreamHashBy UpstreamHashByConfig `json:"upstreamHashByConfig,omitempty"`

View file

@ -381,7 +381,7 @@ func encodePrivateKeyPEM(key *rsa.PrivateKey) []byte {
return pem.EncodeToMemory(&block)
}
// encodeCertPEM returns PEM-endcoded certificate data
// encodeCertPEM returns PEM-encoded certificate data
func encodeCertPEM(cert *x509.Certificate) []byte {
block := pem.Block{
Type: certutil.CertificateBlockType,

View file

@ -66,7 +66,7 @@ func TestEnqueueSuccess(t *testing.T) {
stopCh := make(chan struct{})
// run queue
go q.Run(5*time.Second, stopCh)
// mock object whichi will be enqueue
// mock object which will be enqueue
mo := mockEnqueueObj{
k: "testKey",
v: "testValue",
@ -89,7 +89,7 @@ func TestEnqueueFailed(t *testing.T) {
stopCh := make(chan struct{})
// run queue
go q.Run(5*time.Second, stopCh)
// mock object whichi will be enqueue
// mock object which will be enqueue
mo := mockEnqueueObj{
k: "testKey",
v: "testValue",
@ -115,7 +115,7 @@ func TestEnqueueKeyError(t *testing.T) {
stopCh := make(chan struct{})
// run queue
go q.Run(5*time.Second, stopCh)
// mock object whichi will be enqueue
// mock object which will be enqueue
mo := mockEnqueueObj{
k: "testKey",
v: "testValue",
@ -137,7 +137,7 @@ func TestSkipEnqueue(t *testing.T) {
atomic.StoreUint32(&sr, 0)
q := NewCustomTaskQueue(mockSynFn, mockKeyFn)
stopCh := make(chan struct{})
// mock object whichi will be enqueue
// mock object which will be enqueue
mo := mockEnqueueObj{
k: "testKey",
v: "testValue",