@@ -511,17 +511,15 @@ var _ = Describe("RDSConnectionController", func() {
511511 if condition == nil || condition .Status != metav1 .ConditionTrue || condition .Reason != "Ready" {
512512 return false
513513 }
514- Expect (conn .Status .CredentialsRef ).ShouldNot (BeNil ())
515- Expect (conn .Status .CredentialsRef .Name ).Should (Equal (fmt .Sprintf ("%s-credentials" , conn .Name )))
516- Expect (conn .Status .ConnectionInfoRef ).ShouldNot (BeNil ())
517- Expect (conn .Status .ConnectionInfoRef .Name ).Should (Equal (fmt .Sprintf ("%s-configs" , conn .Name )))
514+ Expect (conn .Status .Binding ).ShouldNot (BeNil ())
515+ Expect (conn .Status .Binding .Name ).Should (Equal (fmt .Sprintf ("%s-connection-credentials" , conn .Name )))
518516 return true
519517 }, timeout ).Should (BeTrue ())
520518
521519 By ("checking the Secret of the Connection" )
522520 secret := & v1.Secret {
523521 ObjectMeta : metav1.ObjectMeta {
524- Name : conn .Status .CredentialsRef .Name ,
522+ Name : conn .Status .Binding .Name ,
525523 Namespace : testNamespace ,
526524 },
527525 }
@@ -535,45 +533,28 @@ var _ = Describe("RDSConnectionController", func() {
535533 Expect (* secretOwner .Controller ).Should (BeTrue ())
536534 Expect (secretOwner .BlockOwnerDeletion ).ShouldNot (BeNil ())
537535 Expect (* secretOwner .BlockOwnerDeletion ).Should (BeTrue ())
536+ Expect (string (secret .Type )).Should (Equal (fmt .Sprintf ("servicebinding.io/%s" , "postgresql" )))
538537 user , userOk := secret .Data ["username" ]
539538 Expect (userOk ).Should (BeTrue ())
540539 Expect (string (user )).Should (Equal ("user-connection-controller" ))
541540 password , passwordOk := secret .Data ["password" ]
542541 Expect (passwordOk ).Should (BeTrue ())
543542 Expect (string (password )).Should (Equal ("testpassword" ))
544-
545- By ("checking the ConfigMap of the Connection" )
546- configmap := & v1.ConfigMap {
547- ObjectMeta : metav1.ObjectMeta {
548- Name : conn .Status .ConnectionInfoRef .Name ,
549- Namespace : testNamespace ,
550- },
551- }
552- err = k8sClient .Get (ctx , client .ObjectKeyFromObject (configmap ), configmap )
553- Expect (err ).ShouldNot (HaveOccurred ())
554- configmapOwner := metav1 .GetControllerOf (configmap )
555- Expect (configmapOwner ).ShouldNot (BeNil ())
556- Expect (configmapOwner .Kind ).Should (Equal ("RDSConnection" ))
557- Expect (configmapOwner .Name ).Should (Equal (conn .Name ))
558- Expect (configmapOwner .Controller ).ShouldNot (BeNil ())
559- Expect (* configmapOwner .Controller ).Should (BeTrue ())
560- Expect (configmapOwner .BlockOwnerDeletion ).ShouldNot (BeNil ())
561- Expect (* configmapOwner .BlockOwnerDeletion ).Should (BeTrue ())
562- t , typeOk := configmap .Data ["type" ]
543+ t , typeOk := secret .Data ["type" ]
563544 Expect (typeOk ).Should (BeTrue ())
564- Expect (t ).Should (Equal ("postgresql" ))
565- provider , providerOk := configmap .Data ["provider" ]
545+ Expect (string ( t ) ).Should (Equal ("postgresql" ))
546+ provider , providerOk := secret .Data ["provider" ]
566547 Expect (providerOk ).Should (BeTrue ())
567- Expect (provider ).Should (Equal ("Red Hat DBaaS / Amazon Relational Database Service (RDS) " ))
568- host , hostOk := configmap .Data ["host" ]
548+ Expect (string ( provider )) .Should (Equal ("rhoda/amazon rds " ))
549+ host , hostOk := secret .Data ["host" ]
569550 Expect (hostOk ).Should (BeTrue ())
570- Expect (host ).Should (Equal ("address-connection-controller" ))
571- port , portOk := configmap .Data ["port" ]
551+ Expect (string ( host ) ).Should (Equal ("address-connection-controller" ))
552+ port , portOk := secret .Data ["port" ]
572553 Expect (portOk ).Should (BeTrue ())
573- Expect (port ).Should (Equal ("9000" ))
574- db , dbOk := configmap .Data ["database" ]
554+ Expect (string ( port ) ).Should (Equal ("9000" ))
555+ db , dbOk := secret .Data ["database" ]
575556 Expect (dbOk ).Should (BeTrue ())
576- Expect (db ).Should (Equal ("postgres" ))
557+ Expect (string ( db ) ).Should (Equal ("postgres" ))
577558 })
578559 })
579560 })
@@ -683,40 +664,44 @@ var _ = Describe("RDSConnectionController", func() {
683664 if condition == nil || condition .Status != metav1 .ConditionTrue || condition .Reason != "Ready" {
684665 return false
685666 }
686- Expect (conn .Status .CredentialsRef ).ShouldNot (BeNil ())
687- Expect (conn .Status .CredentialsRef .Name ).Should (Equal (fmt .Sprintf ("%s-credentials" , conn .Name )))
688- Expect (conn .Status .ConnectionInfoRef ).ShouldNot (BeNil ())
689- Expect (conn .Status .ConnectionInfoRef .Name ).Should (Equal (fmt .Sprintf ("%s-configs" , conn .Name )))
667+ Expect (conn .Status .Binding ).ShouldNot (BeNil ())
668+ Expect (conn .Status .Binding .Name ).Should (Equal (fmt .Sprintf ("%s-connection-credentials" , conn .Name )))
690669 return true
691670 }, timeout ).Should (BeTrue ())
692671
693672 By ("checking the ConfigMap of the Connection" )
694- configmap := & v1.ConfigMap {
673+ secret := & v1.Secret {
695674 ObjectMeta : metav1.ObjectMeta {
696- Name : conn .Status .ConnectionInfoRef .Name ,
675+ Name : conn .Status .Binding .Name ,
697676 Namespace : testNamespace ,
698677 },
699678 }
700- err := k8sClient .Get (ctx , client .ObjectKeyFromObject (configmap ), configmap )
679+ err := k8sClient .Get (ctx , client .ObjectKeyFromObject (secret ), secret )
701680 Expect (err ).ShouldNot (HaveOccurred ())
702- ju , juOk := configmap .Data ["jdbc-url" ]
681+ user , userOk := secret .Data ["username" ]
682+ Expect (userOk ).Should (BeTrue ())
683+ Expect (string (user )).Should (Equal ("user-oracle-connection-controller" ))
684+ password , passwordOk := secret .Data ["password" ]
685+ Expect (passwordOk ).Should (BeTrue ())
686+ Expect (string (password )).Should (Equal ("testpassword" ))
687+ ju , juOk := secret .Data ["jdbc-url" ]
703688 Expect (juOk ).Should (BeTrue ())
704- Expect (ju ).Should (Equal ("jdbc:oracle:thin:@address-oracle-connection-controller:9000/ORCL" ))
705- t , typeOk := configmap .Data ["type" ]
689+ Expect (string ( ju ) ).Should (Equal ("jdbc:oracle:thin:@address-oracle-connection-controller:9000/ORCL" ))
690+ t , typeOk := secret .Data ["type" ]
706691 Expect (typeOk ).Should (BeTrue ())
707- Expect (t ).Should (Equal ("oracle" ))
708- provider , providerOk := configmap .Data ["provider" ]
692+ Expect (string ( t ) ).Should (Equal ("oracle" ))
693+ provider , providerOk := secret .Data ["provider" ]
709694 Expect (providerOk ).Should (BeTrue ())
710- Expect (provider ).Should (Equal ("Red Hat DBaaS / Amazon Relational Database Service (RDS) " ))
711- host , hostOk := configmap .Data ["host" ]
695+ Expect (string ( provider )) .Should (Equal ("rhoda/amazon rds " ))
696+ host , hostOk := secret .Data ["host" ]
712697 Expect (hostOk ).Should (BeTrue ())
713- Expect (host ).Should (Equal ("address-oracle-connection-controller" ))
714- port , portOk := configmap .Data ["port" ]
698+ Expect (string ( host ) ).Should (Equal ("address-oracle-connection-controller" ))
699+ port , portOk := secret .Data ["port" ]
715700 Expect (portOk ).Should (BeTrue ())
716- Expect (port ).Should (Equal ("9000" ))
717- db , dbOk := configmap .Data ["database" ]
701+ Expect (string ( port ) ).Should (Equal ("9000" ))
702+ db , dbOk := secret .Data ["database" ]
718703 Expect (dbOk ).Should (BeTrue ())
719- Expect (db ).Should (Equal ("ORCL" ))
704+ Expect (string ( db ) ).Should (Equal ("ORCL" ))
720705 })
721706 })
722707
@@ -769,40 +754,44 @@ var _ = Describe("RDSConnectionController", func() {
769754 if condition == nil || condition .Status != metav1 .ConditionTrue || condition .Reason != "Ready" {
770755 return false
771756 }
772- Expect (conn .Status .CredentialsRef ).ShouldNot (BeNil ())
773- Expect (conn .Status .CredentialsRef .Name ).Should (Equal (fmt .Sprintf ("%s-credentials" , conn .Name )))
774- Expect (conn .Status .ConnectionInfoRef ).ShouldNot (BeNil ())
775- Expect (conn .Status .ConnectionInfoRef .Name ).Should (Equal (fmt .Sprintf ("%s-configs" , conn .Name )))
757+ Expect (conn .Status .Binding ).ShouldNot (BeNil ())
758+ Expect (conn .Status .Binding .Name ).Should (Equal (fmt .Sprintf ("%s-connection-credentials" , conn .Name )))
776759 return true
777760 }, timeout ).Should (BeTrue ())
778761
779762 By ("checking the ConfigMap of the Connection" )
780- configmap := & v1.ConfigMap {
763+ secret := & v1.Secret {
781764 ObjectMeta : metav1.ObjectMeta {
782- Name : conn .Status .ConnectionInfoRef .Name ,
765+ Name : conn .Status .Binding .Name ,
783766 Namespace : testNamespace ,
784767 },
785768 }
786- err := k8sClient .Get (ctx , client .ObjectKeyFromObject (configmap ), configmap )
769+ err := k8sClient .Get (ctx , client .ObjectKeyFromObject (secret ), secret )
787770 Expect (err ).ShouldNot (HaveOccurred ())
788- ju , juOk := configmap .Data ["jdbc-url" ]
771+ user , userOk := secret .Data ["username" ]
772+ Expect (userOk ).Should (BeTrue ())
773+ Expect (string (user )).Should (Equal ("user-sqlserver-connection-controller" ))
774+ password , passwordOk := secret .Data ["password" ]
775+ Expect (passwordOk ).Should (BeTrue ())
776+ Expect (string (password )).Should (Equal ("testpassword" ))
777+ ju , juOk := secret .Data ["jdbc-url" ]
789778 Expect (juOk ).Should (BeTrue ())
790- Expect (ju ).Should (Equal ("jdbc:sqlserver://address-sqlserver-connection-controller:9000;databaseName=master" ))
791- t , typeOk := configmap .Data ["type" ]
779+ Expect (string ( ju ) ).Should (Equal ("jdbc:sqlserver://address-sqlserver-connection-controller:9000;databaseName=master" ))
780+ t , typeOk := secret .Data ["type" ]
792781 Expect (typeOk ).Should (BeTrue ())
793- Expect (t ).Should (Equal ("sqlserver" ))
794- provider , providerOk := configmap .Data ["provider" ]
782+ Expect (string ( t ) ).Should (Equal ("sqlserver" ))
783+ provider , providerOk := secret .Data ["provider" ]
795784 Expect (providerOk ).Should (BeTrue ())
796- Expect (provider ).Should (Equal ("Red Hat DBaaS / Amazon Relational Database Service (RDS) " ))
797- host , hostOk := configmap .Data ["host" ]
785+ Expect (string ( provider )) .Should (Equal ("rhoda/amazon rds " ))
786+ host , hostOk := secret .Data ["host" ]
798787 Expect (hostOk ).Should (BeTrue ())
799- Expect (host ).Should (Equal ("address-sqlserver-connection-controller" ))
800- port , portOk := configmap .Data ["port" ]
788+ Expect (string ( host ) ).Should (Equal ("address-sqlserver-connection-controller" ))
789+ port , portOk := secret .Data ["port" ]
801790 Expect (portOk ).Should (BeTrue ())
802- Expect (port ).Should (Equal ("9000" ))
803- db , dbOk := configmap .Data ["database" ]
791+ Expect (string ( port ) ).Should (Equal ("9000" ))
792+ db , dbOk := secret .Data ["database" ]
804793 Expect (dbOk ).Should (BeTrue ())
805- Expect (db ).Should (Equal ("master" ))
794+ Expect (string ( db ) ).Should (Equal ("master" ))
806795 })
807796 })
808797 })
0 commit comments