Skip to content

Commit 4a673bb

Browse files
committed
add test to check when logs synced success
1 parent 1225ec8 commit 4a673bb

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

pkg/dashboard/route.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,21 @@ func (r *routeClient) Get(ctx context.Context, name string) (*v1.Route, error) {
5555

5656
// List is only used in cache warming up. So here just pass through
5757
// to APISIX.
58-
func (r *routeClient) List(ctx context.Context, args ...interface{}) ([]*v1.Route, error) {
58+
func (r *routeClient) List(ctx context.Context, listOptions ...interface{}) ([]*v1.Route, error) {
59+
var options ListOptions
60+
if len(listOptions) > 0 {
61+
options = listOptions[0].(ListOptions)
62+
}
63+
if options.From == ListFromCache {
64+
log.Debugw("try to list routes in cache",
65+
zap.String("cluster", r.cluster.name),
66+
zap.String("url", r.url),
67+
)
68+
return r.cluster.cache.ListRoutes("label",
69+
options.KindLabel.Kind,
70+
options.KindLabel.Namespace,
71+
options.KindLabel.Name)
72+
}
5973
log.Debugw("try to list routes in APISIX",
6074
zap.String("cluster", r.cluster.name),
6175
zap.String("url", r.url),

test/e2e/framework/ingress.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
_ "embed"
66
"text/template"
7+
"time"
78

89
"github.com/Masterminds/sprig/v3"
910
"github.com/gruntwork-io/terratest/modules/k8s"
@@ -48,4 +49,5 @@ func (f *Framework) DeployIngress(opts IngressDeployOpts) {
4849
LabelSelector: "control-plane=controller-manager",
4950
})
5051
f.GomegaT.Expect(err).ToNot(HaveOccurred(), "waiting for controller-manager pod ready")
52+
f.WaitControllerManagerLog("All cache synced successfully", 0, time.Minute)
5153
}

test/e2e/framework/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ func (f *Framework) WaitMTLSDPLog(keyword string, sinceSeconds int64, timeout ti
290290
f.WaitPodsLog("app.kubernetes.io/name=apisix,cp-connection=mtls", keyword, sinceSeconds, timeout)
291291
}
292292

293+
func (f *Framework) WaitControllerManagerLog(keyword string, sinceSeconds int64, timeout time.Duration) {
294+
f.WaitPodsLog("control-plane=controller-manager", keyword, sinceSeconds, timeout)
295+
}
296+
293297
func (f *Framework) WaitDPLog(keyword string, sinceSeconds int64, timeout time.Duration) {
294298
f.WaitPodsLog("app.kubernetes.io/name=apisix", keyword, sinceSeconds, timeout)
295299
}

0 commit comments

Comments
 (0)