@@ -33,10 +33,12 @@ var _ = Describe("Notebook controller", func() {
3333
3434 // Define utility constants for object names and testing timeouts/durations and intervals.
3535 const (
36- Name = "test-notebook"
37- Namespace = "default"
38- timeout = time .Second * 10
39- interval = time .Millisecond * 250
36+ Name = "test-notebook"
37+ Namespace = "default"
38+ testLabelName = "testLabel"
39+ testLabelValue = "testLabelValue"
40+ timeout = time .Second * 10
41+ interval = time .Millisecond * 250
4042 )
4143
4244 Context ("When validating the notebook controller" , func () {
@@ -47,6 +49,9 @@ var _ = Describe("Notebook controller", func() {
4749 ObjectMeta : metav1.ObjectMeta {
4850 Name : Name ,
4951 Namespace : Namespace ,
52+ Labels : map [string ]string {
53+ testLabelName : testLabelValue ,
54+ },
5055 },
5156 Spec : nbv1beta1.NotebookSpec {
5257 Template : nbv1beta1.NotebookTemplateSpec {
@@ -73,8 +78,9 @@ var _ = Describe("Notebook controller", func() {
7378 Only the API server is running within envtest. So cannot check actual pods / replicas.
7479 */
7580 By ("By checking that the Notebook has statefulset" )
81+ sts := & appsv1.StatefulSet {}
7682 Eventually (func () (bool , error ) {
77- sts : = & appsv1.StatefulSet {ObjectMeta : metav1.ObjectMeta {
83+ sts = & appsv1.StatefulSet {ObjectMeta : metav1.ObjectMeta {
7884 Name : Name ,
7985 Namespace : Namespace ,
8086 }}
@@ -84,6 +90,8 @@ var _ = Describe("Notebook controller", func() {
8490 }
8591 return true , nil
8692 }, timeout , interval ).Should (BeTrue ())
93+ By ("By checking that the StatefulSet has identical Labels as the Notebook" )
94+ Expect (sts .GetLabels ()).To (Equal (notebook .GetLabels ()))
8795 })
8896 })
8997})
0 commit comments