Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #1963

Merged
merged 2 commits into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions internal/ingress/controller/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ func New(checkOCSP bool,
glog.Infof("secret %v was removed and it is used in ingress annotations. Parsing...", key)
for _, name := range set.List() {
ing, _ := store.GetIngress(name)
store.extractAnnotations(ing)
if ing != nil {
store.extractAnnotations(ing)
}
}

updateCh <- Event{
Expand Down Expand Up @@ -399,7 +401,7 @@ func New(checkOCSP bool,
glog.V(2).Infof("adding configmap %v to backend", mapKey)
store.setConfig(m)
updateCh <- Event{
Type: CreateEvent,
Type: ConfigurationEvent,
Obj: obj,
}
}
Expand All @@ -409,15 +411,15 @@ func New(checkOCSP bool,
m := cur.(*apiv1.ConfigMap)
mapKey := fmt.Sprintf("%s/%s", m.Namespace, m.Name)
if mapKey == configmap {
glog.V(2).Infof("updating configmap backend (%v)", mapKey)
recorder.Eventf(m, apiv1.EventTypeNormal, "UPDATE", fmt.Sprintf("ConfigMap %v", mapKey))
store.setConfig(m)
updateCh <- Event{
Type: ConfigurationEvent,
Obj: cur,
}
}
// updates to configuration configmaps can trigger an update
if mapKey == configmap || mapKey == tcp || mapKey == udp {
if mapKey == tcp || mapKey == udp {
recorder.Eventf(m, apiv1.EventTypeNormal, "UPDATE", fmt.Sprintf("ConfigMap %v", mapKey))
updateCh <- Event{
Type: ConfigurationEvent,
Expand Down
17 changes: 11 additions & 6 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ import (
restclient "k8s.io/client-go/rest"

"github.com/golang/glog"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

const (
podName = "test-ingress-controller"
podName = "test-ingress-controller"
controllerPodName = "nginx-ingress-controller"
)

const (
Expand Down Expand Up @@ -225,12 +227,15 @@ func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) b
}

var pod *v1.Pod
Loop:
for _, p := range l.Items {
if strings.HasPrefix(p.GetName(), "nginx-ingress-controller") &&
len(p.Status.ContainerStatuses) > 0 &&
p.Status.ContainerStatuses[0].State.Running != nil {
pod = &p
break
if strings.HasPrefix(p.GetName(), "nginx-ingress-controller") {
for _, cs := range p.Status.ContainerStatuses {
if cs.State.Running != nil && cs.Name == "nginx-ingress-controller" {
pod = &p
break Loop
}
}
}
}

Expand Down
11 changes: 5 additions & 6 deletions test/e2e/settings/proxy_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"io/ioutil"
"net"
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand All @@ -35,20 +36,21 @@ import (
var _ = framework.IngressNginxDescribe("Proxy Protocol", func() {
f := framework.NewDefaultFramework("proxy-protocol")

setting := "use-proxy-protocol"

BeforeEach(func() {
err := f.NewEchoDeployment()
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
updateConfigmap(setting, "false", f.KubeClientSet)
})

It("should respect port passed by the PROXY Protocol", func() {
host := "proxy-protocol"

setting := "use-proxy-protocol"
updateConfigmap(setting, "true", f.KubeClientSet)
defer updateConfigmap(setting, "false", f.KubeClientSet)

ing, err := f.EnsureIngress(&v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -120,11 +122,8 @@ func updateConfigmap(k, v string, c kubernetes.Interface) {
config.Data = map[string]string{}
}

if config.Data[k] == v {
return
}

config.Data[k] = v
_, err = c.CoreV1().ConfigMaps("ingress-nginx").Update(config)
Expect(err).NotTo(HaveOccurred())
time.Sleep(1 * time.Second)
}
6 changes: 2 additions & 4 deletions test/e2e/settings/server_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ import (

var _ = framework.IngressNginxDescribe("Server Tokens", func() {
f := framework.NewDefaultFramework("server-tokens")
serverTokens := "server-tokens"

BeforeEach(func() {
err := f.NewEchoDeployment()
Expect(err).NotTo(HaveOccurred())
})

AfterEach(func() {
updateConfigmap(serverTokens, "false", f.KubeClientSet)
})

It("should not exists Server header in the response", func() {
serverTokens := "server-tokens"
updateConfigmap(serverTokens, "false", f.KubeClientSet)
defer updateConfigmap(serverTokens, "false", f.KubeClientSet)

ing, err := f.EnsureIngress(&v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -84,9 +84,7 @@ var _ = framework.IngressNginxDescribe("Server Tokens", func() {
})

It("should exists Server header in the response when is enabled", func() {
serverTokens := "server-tokens"
updateConfigmap(serverTokens, "true", f.KubeClientSet)
defer updateConfigmap(serverTokens, "false", f.KubeClientSet)

ing, err := f.EnsureIngress(&v1beta1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Expand Down