From 869aef61af43e5dfd145f6eaac4f12244dbf418f Mon Sep 17 00:00:00 2001 From: Lukasz Szaszkiewicz Date: Tue, 17 Dec 2019 14:29:08 +0100 Subject: [PATCH] improves watch and report e2e test to also check IsResourceExpired since the API can return both errors (Gone, Expired) --- test/e2e/apimachinery/protocol.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/apimachinery/protocol.go b/test/e2e/apimachinery/protocol.go index 9effdae5c1c..13ebccdf6f9 100644 --- a/test/e2e/apimachinery/protocol.go +++ b/test/e2e/apimachinery/protocol.go @@ -64,7 +64,11 @@ var _ = SIGDescribe("client-go should negotiate", func() { // this is allowed case watch.Error: err := errors.FromObject(evt.Object) - if errors.IsGone(err) { + // In Kubernetes 1.17 and earlier, the api server returns both apierrs.StatusReasonExpired and + // apierrs.StatusReasonGone for HTTP 410 (Gone) status code responses. In 1.18 the kube server is more consistent + // and always returns apierrs.StatusReasonExpired. For backward compatibility we can only remove the apierrs.IsGone + // check when we fully drop support for Kubernetes 1.17 servers from reflectors. + if errors.IsGone(err) || errors.IsResourceExpired(err) { // this is allowed, since the kubernetes object could be very old break }