-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate upgrade tests to use the upgrade framework
- Loading branch information
Showing
10 changed files
with
386 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package common | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud" | ||
"k8s.io/api/networking/v1beta1" | ||
"k8s.io/ingress-gce/pkg/e2e" | ||
"k8s.io/ingress-gce/pkg/fuzz" | ||
"k8s.io/ingress-gce/pkg/fuzz/features" | ||
) | ||
|
||
func WaitForStableIngress(expectUnreachable bool, ing *v1beta1.Ingress, s *e2e.Sandbox, t *testing.T) *v1beta1.Ingress { | ||
options := &e2e.WaitForIngressOptions{ | ||
ExpectUnreachable: expectUnreachable, | ||
} | ||
|
||
ing, err := e2e.WaitForIngress(s, ing, options) | ||
if err != nil { | ||
t.Fatalf("error waiting for Ingress to stabilize: %v", err) | ||
} | ||
|
||
s.PutStatus(e2e.Stable) | ||
return ing | ||
} | ||
|
||
func WhiteboxTest(ing *v1beta1.Ingress, s *e2e.Sandbox, t *testing.T, cloud cloud.Cloud, region string) *fuzz.GCLB { | ||
if len(ing.Status.LoadBalancer.Ingress) < 1 { | ||
t.Fatalf("Ingress does not have an IP: %+v", ing.Status) | ||
} | ||
|
||
vip := ing.Status.LoadBalancer.Ingress[0].IP | ||
t.Logf("Ingress %s/%s VIP = %s", s.Namespace, ing.Name, vip) | ||
params := &fuzz.GCLBForVIPParams{ | ||
VIP: vip, | ||
Region: region, | ||
Validators: fuzz.FeatureValidators(features.All), | ||
} | ||
gclb, err := fuzz.GCLBForVIP(context.Background(), cloud, params) | ||
if err != nil { | ||
t.Fatalf("Error getting GCP resources for LB with IP = %q: %v", vip, err) | ||
} | ||
|
||
if err := e2e.PerformWhiteboxTests(s, ing, gclb); err != nil { | ||
t.Fatalf("Error performing whitebox tests: %v", err) | ||
} | ||
return gclb | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.