@@ -1673,6 +1673,45 @@ func TestDescribeDeployment(t *testing.T) {
1673
1673
}
1674
1674
}
1675
1675
1676
+ func TestDescribeIngress (t * testing.T ) {
1677
+ defaultBackend := networkingv1beta1.IngressBackend {
1678
+ ServiceName : "default-backend" ,
1679
+ ServicePort : intstr .FromInt (80 ),
1680
+ }
1681
+
1682
+ fakeClient := fake .NewSimpleClientset (& networkingv1beta1.Ingress {
1683
+ ObjectMeta : metav1.ObjectMeta {
1684
+ Name : "bar" ,
1685
+ Namespace : "foo" ,
1686
+ },
1687
+ Spec : networkingv1beta1.IngressSpec {
1688
+ Rules : []networkingv1beta1.IngressRule {
1689
+ {
1690
+ Host : "foo.bar.com" ,
1691
+ IngressRuleValue : networkingv1beta1.IngressRuleValue {
1692
+ HTTP : & networkingv1beta1.HTTPIngressRuleValue {
1693
+ Paths : []networkingv1beta1.HTTPIngressPath {
1694
+ {
1695
+ Path : "/foo" ,
1696
+ Backend : defaultBackend ,
1697
+ },
1698
+ },
1699
+ },
1700
+ },
1701
+ },
1702
+ },
1703
+ },
1704
+ })
1705
+ i := IngressDescriber {fakeClient }
1706
+ out , err := i .Describe ("foo" , "bar" , DescriberSettings {ShowEvents : true })
1707
+ if err != nil {
1708
+ t .Errorf ("unexpected error: %v" , err )
1709
+ }
1710
+ if ! strings .Contains (out , "bar" ) || ! strings .Contains (out , "foo" ) || ! strings .Contains (out , "foo.bar.com" ) || ! strings .Contains (out , "/foo" ) {
1711
+ t .Errorf ("unexpected out: %s" , out )
1712
+ }
1713
+ }
1714
+
1676
1715
func TestDescribeStorageClass (t * testing.T ) {
1677
1716
reclaimPolicy := corev1 .PersistentVolumeReclaimRetain
1678
1717
bindingMode := storagev1 .VolumeBindingMode ("bindingmode" )
@@ -2660,8 +2699,15 @@ func TestDescribeEvents(t *testing.T) {
2660
2699
}, events ),
2661
2700
},
2662
2701
// TODO(jchaloup): add tests for:
2663
- // - IngressDescriber
2664
2702
// - JobDescriber
2703
+ "IngressDescriber" : & IngressDescriber {
2704
+ fake .NewSimpleClientset (& networkingv1beta1.Ingress {
2705
+ ObjectMeta : metav1.ObjectMeta {
2706
+ Name : "bar" ,
2707
+ Namespace : "foo" ,
2708
+ },
2709
+ }, events ),
2710
+ },
2665
2711
"NodeDescriber" : & NodeDescriber {
2666
2712
fake .NewSimpleClientset (& corev1.Node {
2667
2713
ObjectMeta : metav1.ObjectMeta {
0 commit comments