@@ -39,81 +39,88 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker bind test", f
39
39
cliUser user.Info
40
40
)
41
41
42
- g.BeforeEach(func() {
43
- framework.SkipIfProviderIs("gce")
44
-
45
- var err error
46
-
47
- brokercli, portForwardCmdClose = EnsureTSB(tsbOC)
48
-
49
- cliUser = &user.DefaultInfo{Name: cli.Username(), Groups: []string{"system:authenticated"}}
50
-
51
- // enable unauthenticated access to the service broker
52
- clusterrolebinding, err = cli.AdminAuthorizationClient().Authorization().ClusterRoleBindings().Create(&authorizationapi.ClusterRoleBinding{
53
- ObjectMeta: metav1.ObjectMeta{
54
- Name: cli.Namespace() + "templateservicebroker-client",
55
- },
56
- RoleRef: kapi.ObjectReference{
57
- Name: bootstrappolicy.TemplateServiceBrokerClientRoleName,
58
- },
59
- Subjects: []kapi.ObjectReference{
60
- {
61
- Kind: authorizationapi.GroupKind,
62
- Name: bootstrappolicy.UnauthenticatedGroup,
63
- },
64
- },
65
- })
66
- o.Expect(err).NotTo(o.HaveOccurred())
42
+ g.Context("", func() {
43
+ g.BeforeEach(func() {
44
+ framework.SkipIfProviderIs("gce")
67
45
68
- err = cli.AsAdmin().Run("new-app").Args(fixture, "-p", "NAMESPACE="+cli.Namespace()).Execute()
69
- o.Expect(err).NotTo(o.HaveOccurred())
46
+ var err error
70
47
71
- // wait for templateinstance controller to do its thing
72
- err = wait.Poll(time.Second, time.Minute, func() (bool, error) {
73
- templateinstance, err := cli.TemplateClient().Template().TemplateInstances(cli.Namespace()).Get(instanceID, metav1.GetOptions{})
74
- if err != nil {
75
- return false, err
76
- }
48
+ brokercli, portForwardCmdClose = EnsureTSB(tsbOC)
49
+
50
+ cliUser = &user.DefaultInfo{Name: cli.Username(), Groups: []string{"system:authenticated"}}
51
+
52
+ // enable unauthenticated access to the service broker
53
+ clusterrolebinding, err = cli.AdminAuthorizationClient().Authorization().ClusterRoleBindings().Create(&authorizationapi.ClusterRoleBinding{
54
+ ObjectMeta: metav1.ObjectMeta{
55
+ Name: cli.Namespace() + "templateservicebroker-client",
56
+ },
57
+ RoleRef: kapi.ObjectReference{
58
+ Name: bootstrappolicy.TemplateServiceBrokerClientRoleName,
59
+ },
60
+ Subjects: []kapi.ObjectReference{
61
+ {
62
+ Kind: authorizationapi.GroupKind,
63
+ Name: bootstrappolicy.UnauthenticatedGroup,
64
+ },
65
+ },
66
+ })
67
+ o.Expect(err).NotTo(o.HaveOccurred())
77
68
78
- for _, c := range templateinstance.Status.Conditions {
79
- if c.Reason == "Failed" && c.Status == kapi.ConditionTrue {
80
- return false, fmt.Errorf("failed condition: %s", c.Message)
69
+ err = cli.AsAdmin().Run("new-app").Args(fixture, "-p", "NAMESPACE="+cli.Namespace()).Execute()
70
+ o.Expect(err).NotTo(o.HaveOccurred())
71
+
72
+ // wait for templateinstance controller to do its thing
73
+ err = wait.Poll(time.Second, time.Minute, func() (bool, error) {
74
+ templateinstance, err := cli.TemplateClient().Template().TemplateInstances(cli.Namespace()).Get(instanceID, metav1.GetOptions{})
75
+ if err != nil {
76
+ return false, err
81
77
}
82
- if c.Reason == "Created" && c.Status == kapi.ConditionTrue {
83
- return true, nil
78
+
79
+ for _, c := range templateinstance.Status.Conditions {
80
+ if c.Reason == "Failed" && c.Status == kapi.ConditionTrue {
81
+ return false, fmt.Errorf("failed condition: %s", c.Message)
82
+ }
83
+ if c.Reason == "Created" && c.Status == kapi.ConditionTrue {
84
+ return true, nil
85
+ }
84
86
}
85
- }
86
87
87
- return false, nil
88
+ return false, nil
89
+ })
90
+ o.Expect(err).NotTo(o.HaveOccurred())
88
91
})
89
- o.Expect(err).NotTo(o.HaveOccurred())
90
- })
91
92
92
- g.AfterEach(func() {
93
- err := cli.AdminAuthorizationClient().Authorization().ClusterRoleBindings().Delete(clusterrolebinding.Name, nil)
94
- o.Expect(err).NotTo(o.HaveOccurred())
95
-
96
- err = cli.AdminTemplateClient().Template().BrokerTemplateInstances().Delete(instanceID, &metav1.DeleteOptions{})
97
- o.Expect(err).NotTo(o.HaveOccurred())
93
+ g.AfterEach(func() {
94
+ if g.CurrentGinkgoTestDescription().Failed {
95
+ exutil.DumpPodStates(tsbOC)
96
+ exutil.DumpPodLogsStartingWith("", tsbOC)
97
+ }
98
98
99
- err = portForwardCmdClose()
100
- o.Expect(err).NotTo(o.HaveOccurred())
101
- })
99
+ err := cli.AdminAuthorizationClient().Authorization().ClusterRoleBindings().Delete(clusterrolebinding.Name, nil)
100
+ o.Expect(err).NotTo(o.HaveOccurred())
102
101
103
- g.It("should pass bind tests", func() {
104
- svc, err := cli.KubeClient().Core().Services(cli.Namespace()).Get("service", metav1.GetOptions{})
105
- o.Expect(err).NotTo(o.HaveOccurred())
102
+ err = cli.AdminTemplateClient().Template().BrokerTemplateInstances().Delete(instanceID, &metav1.DeleteOptions{})
103
+ o.Expect(err).NotTo(o.HaveOccurred())
106
104
107
- bind, err := brokercli.Bind(context.Background(), cliUser, instanceID, bindingID, &api.BindRequest{
108
- ServiceID: serviceID,
109
- PlanID: uuid.NewRandom().String(),
105
+ err = portForwardCmdClose()
106
+ o.Expect(err).NotTo(o.HaveOccurred())
110
107
})
111
- o.Expect(err).NotTo(o.HaveOccurred())
112
108
113
- o.Expect(bind.Credentials).To(o.HaveKeyWithValue("configmap-username", "configmap-username"))
114
- o.Expect(bind.Credentials).To(o.HaveKeyWithValue("secret-username", "secret-username"))
115
- o.Expect(bind.Credentials).To(o.HaveKeyWithValue("secret-password", "c2VjcmV0LXBhc3N3b3Jk"))
116
- o.Expect(bind.Credentials).To(o.HaveKeyWithValue("service-uri", "http://"+svc.Spec.ClusterIP+":1234"))
117
- o.Expect(bind.Credentials).To(o.HaveKeyWithValue("route-uri", "http://host/path"))
109
+ g.It("should pass bind tests", func() {
110
+ svc, err := cli.KubeClient().Core().Services(cli.Namespace()).Get("service", metav1.GetOptions{})
111
+ o.Expect(err).NotTo(o.HaveOccurred())
112
+
113
+ bind, err := brokercli.Bind(context.Background(), cliUser, instanceID, bindingID, &api.BindRequest{
114
+ ServiceID: serviceID,
115
+ PlanID: uuid.NewRandom().String(),
116
+ })
117
+ o.Expect(err).NotTo(o.HaveOccurred())
118
+
119
+ o.Expect(bind.Credentials).To(o.HaveKeyWithValue("configmap-username", "configmap-username"))
120
+ o.Expect(bind.Credentials).To(o.HaveKeyWithValue("secret-username", "secret-username"))
121
+ o.Expect(bind.Credentials).To(o.HaveKeyWithValue("secret-password", "c2VjcmV0LXBhc3N3b3Jk"))
122
+ o.Expect(bind.Credentials).To(o.HaveKeyWithValue("service-uri", "http://"+svc.Spec.ClusterIP+":1234"))
123
+ o.Expect(bind.Credentials).To(o.HaveKeyWithValue("route-uri", "http://host/path"))
124
+ })
118
125
})
119
126
})
0 commit comments