@@ -71,59 +71,54 @@ func TestGetWatchNamespace(t *testing.T) {
7171 },
7272 expectError : false ,
7373 }, {
74- name : "cluster extension configures a watch namespace through annotation " ,
74+ name : "cluster extension configures a watch namespace through spec.config.inline " ,
7575 want : "watch-namespace" ,
7676 csv : & ocv1.ClusterExtension {
7777 ObjectMeta : metav1.ObjectMeta {
7878 Name : "extension" ,
79- Annotations : map [string ]string {
80- "olm.operatorframework.io/watch-namespace" : "watch-namespace" ,
79+ },
80+ Spec : ocv1.ClusterExtensionSpec {
81+ Config : & ocv1.ClusterExtensionConfig {
82+ ConfigType : ocv1 .ClusterExtensionConfigTypeInline ,
83+ Inline : & apiextensionsv1.JSON {
84+ Raw : []byte (`{"watchNamespace":"watch-namespace"}` ),
85+ },
8186 },
8287 },
8388 },
8489 expectError : false ,
8590 }, {
86- name : "cluster extension configures a watch namespace through annotation with invalid ns" ,
91+ name : "cluster extension configures a watch namespace through spec.config.inline with invalid ns" ,
8792 csv : & ocv1.ClusterExtension {
8893 ObjectMeta : metav1.ObjectMeta {
8994 Name : "extension" ,
90- Annotations : map [string ]string {
91- "olm.operatorframework.io/watch-namespace" : "watch-namespace-" ,
92- },
9395 },
94- },
95- expectError : true ,
96- }, {
97- name : "cluster extension configures a watch namespace through annotation with empty ns" ,
98- csv : & ocv1.ClusterExtension {
99- ObjectMeta : metav1.ObjectMeta {
100- Name : "extension" ,
101- Annotations : map [string ]string {
102- "olm.operatorframework.io/watch-namespace" : "" ,
96+ Spec : ocv1.ClusterExtensionSpec {
97+ Config : & ocv1.ClusterExtensionConfig {
98+ ConfigType : ocv1 .ClusterExtensionConfigTypeInline ,
99+ Inline : & apiextensionsv1.JSON {
100+ Raw : []byte (`{"watchNamespace":"watch-namespace-"}` ),
101+ },
103102 },
104103 },
105104 },
106105 expectError : true ,
107106 }, {
108- name : "cluster extension configures a watch namespace through annotation and config (take config)" ,
109- want : "watch-namespace" ,
107+ name : "cluster extension configures a watch namespace through spec.config.inline with empty ns" ,
110108 csv : & ocv1.ClusterExtension {
111109 ObjectMeta : metav1.ObjectMeta {
112110 Name : "extension" ,
113- Annotations : map [string ]string {
114- "olm.operatorframework.io/watch-namespace" : "dont-use-this-watch-namespace" ,
115- },
116111 },
117112 Spec : ocv1.ClusterExtensionSpec {
118113 Config : & ocv1.ClusterExtensionConfig {
119114 ConfigType : ocv1 .ClusterExtensionConfigTypeInline ,
120115 Inline : & apiextensionsv1.JSON {
121- Raw : []byte (`{"watchNamespace":"watch-namespace "}` ),
116+ Raw : []byte (`{"watchNamespace":""}` ),
122117 },
123118 },
124119 },
125120 },
126- expectError : false ,
121+ expectError : true ,
127122 }, {
128123 name : "cluster extension configures an invalid watchNamespace: multiple watch namespaces" ,
129124 want : "" ,
0 commit comments