@@ -2,6 +2,7 @@ package wait
22
33import (
44 "context"
5+ "errors"
56 "net/http"
67 "strings"
78 "testing"
@@ -119,7 +120,7 @@ func TestCreateDistributionWaitHandler(t *testing.T) {
119120 distributionId : distributionId ,
120121 expectedDistribution : nil ,
121122 errCheck : func (t * testing.T , err error ) {
122- if err . Error () == "WaitWithContext() has timed out" {
123+ if errors . Is ( err , context . DeadlineExceeded ) {
123124 return
124125 }
125126 t .Fatalf ("Unexpected error: %v" , err )
@@ -133,7 +134,7 @@ func TestCreateDistributionWaitHandler(t *testing.T) {
133134 distributionId : distributionId ,
134135 expectedDistribution : nil ,
135136 errCheck : func (t * testing.T , err error ) {
136- if err . Error () == "WaitWithContext() has timed out" {
137+ if errors . Is ( err , context . DeadlineExceeded ) {
137138 return
138139 }
139140 t .Fatalf ("Unexpected error: %v" , err )
@@ -223,7 +224,7 @@ func TestDeleteDistributionWaitHandler(t *testing.T) {
223224 projectId : projectId ,
224225 distributionId : distributionId ,
225226 errCheck : func (t * testing.T , err error ) {
226- if err . Error () == "WaitWithContext() has timed out" {
227+ if errors . Is ( err , context . DeadlineExceeded ) {
227228 return
228229 }
229230 t .Fatalf ("Unexpected error: %v" , err )
@@ -236,7 +237,7 @@ func TestDeleteDistributionWaitHandler(t *testing.T) {
236237 projectId : projectId ,
237238 distributionId : distributionId ,
238239 errCheck : func (t * testing.T , err error ) {
239- if err . Error () == "WaitWithContext() has timed out" {
240+ if errors . Is ( err , context . DeadlineExceeded ) {
240241 return
241242 }
242243 t .Fatalf ("Unexpected error: %v" , err )
@@ -249,7 +250,7 @@ func TestDeleteDistributionWaitHandler(t *testing.T) {
249250 projectId : projectId ,
250251 distributionId : distributionId ,
251252 errCheck : func (t * testing.T , err error ) {
252- if err . Error () == "WaitWithContext() has timed out" {
253+ if errors . Is ( err , context . DeadlineExceeded ) {
253254 return
254255 }
255256 t .Fatalf ("Unexpected error: %v" , err )
@@ -262,7 +263,7 @@ func TestDeleteDistributionWaitHandler(t *testing.T) {
262263 projectId : projectId ,
263264 distributionId : distributionId ,
264265 errCheck : func (t * testing.T , err error ) {
265- if err . Error () == "WaitWithContext() has timed out" {
266+ if errors . Is ( err , context . DeadlineExceeded ) {
266267 return
267268 }
268269 t .Fatalf ("Unexpected error: %v" , err )
@@ -275,7 +276,7 @@ func TestDeleteDistributionWaitHandler(t *testing.T) {
275276 projectId : projectId ,
276277 distributionId : distributionId ,
277278 errCheck : func (t * testing.T , err error ) {
278- if err . Error () == "WaitWithContext() has timed out" {
279+ if errors . Is ( err , context . DeadlineExceeded ) {
279280 return
280281 }
281282 t .Fatalf ("Unexpected error: %v" , err )
@@ -348,7 +349,7 @@ func TestUpdateDistributionWaitHandler(t *testing.T) {
348349 distributionId : distributionId ,
349350 expectedDistribution : nil ,
350351 errCheck : func (t * testing.T , err error ) {
351- if err . Error () == "WaitWithContext() has timed out" {
352+ if errors . Is ( err , context . DeadlineExceeded ) {
352353 return
353354 }
354355 t .Fatalf ("Unexpected error: %v" , err )
@@ -461,7 +462,7 @@ func TestCreateCustomDomainWaitHandler(t *testing.T) {
461462 customDomain : customDomain ,
462463 expectedCustomDomain : nil ,
463464 errCheck : func (t * testing.T , err error ) {
464- if err != nil && err . Error () == "WaitWithContext() has timed out" {
465+ if err != nil && errors . Is ( err , context . DeadlineExceeded ) {
465466 return
466467 }
467468 t .Fatalf ("Unexpected error: %v" , err )
@@ -572,7 +573,7 @@ func TestDeleteCustomDomainHandler(t *testing.T) {
572573 distributionId : distributionId ,
573574 customDomain : customDomain ,
574575 errCheck : func (t * testing.T , err error ) {
575- if err != nil && err . Error () == "WaitWithContext() has timed out" {
576+ if err != nil && errors . Is ( err , context . DeadlineExceeded ) {
576577 return
577578 }
578579 t .Fatalf ("Unexpected error: %v" , err )
@@ -586,7 +587,7 @@ func TestDeleteCustomDomainHandler(t *testing.T) {
586587 distributionId : distributionId ,
587588 customDomain : customDomain ,
588589 errCheck : func (t * testing.T , err error ) {
589- if err != nil && err . Error () == "WaitWithContext() has timed out" {
590+ if err != nil && errors . Is ( err , context . DeadlineExceeded ) {
590591 return
591592 }
592593 t .Fatalf ("Unexpected error: %v" , err )
@@ -600,7 +601,7 @@ func TestDeleteCustomDomainHandler(t *testing.T) {
600601 distributionId : distributionId ,
601602 customDomain : customDomain ,
602603 errCheck : func (t * testing.T , err error ) {
603- if err != nil && err . Error () == "WaitWithContext() has timed out" {
604+ if err != nil && errors . Is ( err , context . DeadlineExceeded ) {
604605 return
605606 }
606607 t .Fatalf ("Unexpected error: %v" , err )
@@ -614,7 +615,7 @@ func TestDeleteCustomDomainHandler(t *testing.T) {
614615 distributionId : distributionId ,
615616 customDomain : customDomain ,
616617 errCheck : func (t * testing.T , err error ) {
617- if err != nil && err . Error () == "WaitWithContext() has timed out" {
618+ if err != nil && errors . Is ( err , context . DeadlineExceeded ) {
618619 return
619620 }
620621 t .Fatalf ("Unexpected error: %v" , err )
@@ -628,7 +629,7 @@ func TestDeleteCustomDomainHandler(t *testing.T) {
628629 distributionId : distributionId ,
629630 customDomain : customDomain ,
630631 errCheck : func (t * testing.T , err error ) {
631- if err != nil && err . Error () == "WaitWithContext() has timed out" {
632+ if err != nil && errors . Is ( err , context . DeadlineExceeded ) {
632633 return
633634 }
634635 t .Fatalf ("Unexpected error: %v" , err )
0 commit comments