Skip to content

Commit

Permalink
fixup extended tests to use bindable template
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Minter committed Nov 7, 2017
1 parent 613bbb9 commit 92f42fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions test/extended/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ function os::test::extended::setup () {

os::log::info "Creating quickstart templates"
oc create -n openshift -f "${OS_ROOT}/examples/quickstarts" --config="${ADMIN_KUBECONFIG}"

os::log::info "Creating db-templates templates"
oc create -n openshift -f "${OS_ROOT}/examples/db-templates" --config="${ADMIN_KUBECONFIG}"
}

# Run extended tests or print out a list of tests that need to be run
Expand Down
14 changes: 7 additions & 7 deletions test/extended/templates/templateservicebroker_e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker end-to-end te
cliUser = &user.DefaultInfo{Name: cli.Username(), Groups: []string{"system:authenticated"}}

// should have been created before the extended test runs
template, err = cli.TemplateClient().Template().Templates("openshift").Get("cakephp-mysql-example", metav1.GetOptions{})
template, err = cli.TemplateClient().Template().Templates("openshift").Get("mysql-ephemeral", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

processedtemplate, err = internalversion.NewTemplateProcessorClient(cli.AdminTemplateClient().Template().RESTClient(), "openshift").Process(template)
Expand Down Expand Up @@ -155,17 +155,17 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker end-to-end te
Namespace: cli.Namespace(),
},
Parameters: map[string]string{
"DATABASE_USER": "test",
"MYSQL_USER": "test",
},
})
if err != nil {
templateInstance, err := cli.TemplateClient().Template().TemplateInstances(cli.Namespace()).Get(instanceID, metav1.GetOptions{})
if err != nil {
fmt.Fprintf(g.GinkgoWriter, "error getting TemplateInstance after failed provision: %v", err)
fmt.Fprintf(g.GinkgoWriter, "error getting TemplateInstance after failed provision: %v\n", err)
} else {
err := dumpObjectReadiness(cli, templateInstance)
if err != nil {
fmt.Fprintf(g.GinkgoWriter, "error running dumpObjectReadiness: %v", err)
fmt.Fprintf(g.GinkgoWriter, "error running dumpObjectReadiness: %v\n", err)
}
}
}
Expand Down Expand Up @@ -237,10 +237,10 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker end-to-end te
}))
o.Expect(secret.Type).To(o.Equal(v1.SecretTypeOpaque))
o.Expect(secret.Data).To(o.Equal(map[string][]byte{
"DATABASE_USER": []byte("test"),
"MYSQL_USER": []byte("test"),
}))

examplesecret, err := cli.KubeClient().CoreV1().Secrets(cli.Namespace()).Get("cakephp-mysql-example", metav1.GetOptions{})
examplesecret, err := cli.KubeClient().CoreV1().Secrets(cli.Namespace()).Get("mysql", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

o.Expect(examplesecret.OwnerReferences).To(o.ContainElement(metav1.OwnerReference{
Expand Down Expand Up @@ -268,7 +268,7 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker end-to-end te
o.Expect(brokerTemplateInstance.Spec.BindingIDs).To(o.Equal([]string{bindingID}))

o.Expect(bind.Credentials).To(o.HaveKey("uri"))
o.Expect(bind.Credentials["uri"]).To(o.HavePrefix("http://"))
o.Expect(bind.Credentials["uri"]).To(o.HavePrefix("mysql://"))
}

unbind := func() {
Expand Down
6 changes: 3 additions & 3 deletions test/extended/templates/templateservicebroker_security.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker security test

brokercli, portForwardCmdClose = EnsureTSB(tsbOC)

template, err = cli.TemplateClient().Template().Templates("openshift").Get("cakephp-mysql-example", metav1.GetOptions{})
template, err = cli.TemplateClient().Template().Templates("openshift").Get("mysql-ephemeral", metav1.GetOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

clusterrolebinding, err = cli.AdminAuthorizationClient().Authorization().ClusterRoleBindings().Create(&authorizationapi.ClusterRoleBinding{
Expand Down Expand Up @@ -122,11 +122,11 @@ var _ = g.Describe("[Conformance][templates] templateservicebroker security test
if err != nil {
templateInstance, err := cli.TemplateClient().Template().TemplateInstances(cli.Namespace()).Get(instanceID, metav1.GetOptions{})
if err != nil {
fmt.Fprintf(g.GinkgoWriter, "error getting TemplateInstance after failed provision: %v", err)
fmt.Fprintf(g.GinkgoWriter, "error getting TemplateInstance after failed provision: %v\n", err)
} else {
err := dumpObjectReadiness(cli, templateInstance)
if err != nil {
fmt.Fprintf(g.GinkgoWriter, "error running dumpObjectReadiness: %v", err)
fmt.Fprintf(g.GinkgoWriter, "error running dumpObjectReadiness: %v\n", err)
}
}
}
Expand Down

0 comments on commit 92f42fa

Please sign in to comment.