Move DescribeIng() into e2eingress

The function is only for e2e ingress test, it is not necessary to
keep the function in e2e test core framework.
This commit is contained in:
Kenichi Omichi 2020-04-06 19:48:27 +00:00
parent 64d75b3bad
commit 2f5f16004d
3 changed files with 13 additions and 13 deletions

View File

@ -557,6 +557,14 @@ func (j *TestJig) runUpdate(ing *networkingv1beta1.Ingress) (*networkingv1beta1.
return ing, err return ing, err
} }
// DescribeIng describes information of ingress by running kubectl describe ing.
func DescribeIng(ns string) {
framework.Logf("\nOutput of kubectl describe ing:\n")
desc, _ := framework.RunKubectl(
ns, "describe", "ing", fmt.Sprintf("--namespace=%v", ns))
framework.Logf(desc)
}
// Update retrieves the ingress, performs the passed function, and then updates it. // Update retrieves the ingress, performs the passed function, and then updates it.
func (j *TestJig) Update(update func(ing *networkingv1beta1.Ingress)) { func (j *TestJig) Update(update func(ing *networkingv1beta1.Ingress)) {
var err error var err error
@ -569,7 +577,7 @@ func (j *TestJig) Update(update func(ing *networkingv1beta1.Ingress)) {
update(j.Ingress) update(j.Ingress)
j.Ingress, err = j.runUpdate(j.Ingress) j.Ingress, err = j.runUpdate(j.Ingress)
if err == nil { if err == nil {
framework.DescribeIng(j.Ingress.Namespace) DescribeIng(j.Ingress.Namespace)
return return
} }
if !apierrors.IsConflict(err) && !apierrors.IsServerTimeout(err) { if !apierrors.IsConflict(err) && !apierrors.IsServerTimeout(err) {

View File

@ -1236,14 +1236,6 @@ func GetAllMasterAddresses(c clientset.Interface) []string {
return ips.List() return ips.List()
} }
// DescribeIng describes information of ingress by running kubectl describe ing.
func DescribeIng(ns string) {
Logf("\nOutput of kubectl describe ing:\n")
desc, _ := RunKubectl(
ns, "describe", "ing", fmt.Sprintf("--namespace=%v", ns))
Logf(desc)
}
// CreateEmptyFileOnPod creates empty file at given path on the pod. // CreateEmptyFileOnPod creates empty file at given path on the pod.
// TODO(alejandrox1): move to subpkg pod once kubectl methods have been refactored. // TODO(alejandrox1): move to subpkg pod once kubectl methods have been refactored.
func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error { func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error {

View File

@ -101,7 +101,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
// Platform specific cleanup // Platform specific cleanup
ginkgo.AfterEach(func() { ginkgo.AfterEach(func() {
if ginkgo.CurrentGinkgoTestDescription().Failed { if ginkgo.CurrentGinkgoTestDescription().Failed {
framework.DescribeIng(ns) e2eingress.DescribeIng(ns)
} }
if jig.Ingress == nil { if jig.Ingress == nil {
ginkgo.By("No ingress created, no cleanup necessary") ginkgo.By("No ingress created, no cleanup necessary")
@ -257,7 +257,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
// Platform specific cleanup // Platform specific cleanup
ginkgo.AfterEach(func() { ginkgo.AfterEach(func() {
if ginkgo.CurrentGinkgoTestDescription().Failed { if ginkgo.CurrentGinkgoTestDescription().Failed {
framework.DescribeIng(ns) e2eingress.DescribeIng(ns)
} }
if jig.Ingress == nil { if jig.Ingress == nil {
ginkgo.By("No ingress created, no cleanup necessary") ginkgo.By("No ingress created, no cleanup necessary")
@ -614,7 +614,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
// Platform specific cleanup // Platform specific cleanup
ginkgo.AfterEach(func() { ginkgo.AfterEach(func() {
if ginkgo.CurrentGinkgoTestDescription().Failed { if ginkgo.CurrentGinkgoTestDescription().Failed {
framework.DescribeIng(ns) e2eingress.DescribeIng(ns)
} }
if jig.Ingress == nil { if jig.Ingress == nil {
ginkgo.By("No ingress created, no cleanup necessary") ginkgo.By("No ingress created, no cleanup necessary")
@ -741,7 +741,7 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
framework.ExpectNoError(gce.GcloudComputeResourceDelete("firewall-rules", fmt.Sprintf("ingress-80-443-%v", ns), framework.TestContext.CloudConfig.ProjectID)) framework.ExpectNoError(gce.GcloudComputeResourceDelete("firewall-rules", fmt.Sprintf("ingress-80-443-%v", ns), framework.TestContext.CloudConfig.ProjectID))
} }
if ginkgo.CurrentGinkgoTestDescription().Failed { if ginkgo.CurrentGinkgoTestDescription().Failed {
framework.DescribeIng(ns) e2eingress.DescribeIng(ns)
} }
defer nginxController.TearDown() defer nginxController.TearDown()
if jig.Ingress == nil { if jig.Ingress == nil {