@@ -123,75 +123,74 @@ mod tests {
123
123
} ;
124
124
use linkerd_proxy_server_policy:: { Authentication , Authorization , Meta , ServerPolicy } ;
125
125
use std:: sync:: Arc ;
126
- // TODO(eliza): what to actually do with these tests?
127
-
128
- // #[tokio::test(flavor = "current_thread")]
129
- // async fn default_allow() {
130
- // let (io, _) = io::duplex(1);
131
- // let policies = Store::for_test(std::iter::once((
132
- // 1000,
133
- // ServerPolicy {
134
- // protocol: linkerd_proxy_server_policy::Protocol::Opaque(Arc::new([
135
- // Authorization {
136
- // authentication: Authentication::Unauthenticated,
137
- // networks: vec![Default::default()],
138
- // meta: Arc::new(Meta::Resource {
139
- // group: "policy.linkerd.io".into(),
140
- // kind: "serverauthorization".into(),
141
- // name: "testsaz".into(),
142
- // }),
143
- // },
144
- // ])),
145
- // meta: Arc::new(Meta::Resource {
146
- // group: "policy.linkerd.io".into(),
147
- // kind: "server".into(),
148
- // name: "testsrv".into(),
149
- // }),
150
- // },
151
- // )));
152
- // inbound()
153
- // .with_stack(new_ok())
154
- // .push_accept(999, policies, new_panic("direct stack must not be built"))
155
- // .into_inner()
156
- // .new_service(Target(1000))
157
- // .oneshot(io)
158
- // .await
159
- // .expect("should succeed");
160
- // }
161
-
162
- // #[tokio::test(flavor = "current_thread")]
163
- // async fn direct() {
164
- // let policies = Store::for_test(std::iter::once((
165
- // 1000,
166
- // ServerPolicy {
167
- // protocol: linkerd_proxy_server_policy::Protocol::Opaque(Arc::new([
168
- // Authorization {
169
- // authentication: Authentication::Unauthenticated,
170
- // networks: vec![Default::default()],
171
- // meta: Arc::new(Meta::Resource {
172
- // group: "policy.linkerd.io".into(),
173
- // kind: "serverauthorization".into(),
174
- // name: "testsaz".into(),
175
- // }),
176
- // },
177
- // ])),
178
- // meta: Arc::new(Meta::Resource {
179
- // group: "policy.linkerd.io".into(),
180
- // kind: "server".into(),
181
- // name: "testsrv".into(),
182
- // }),
183
- // },
184
- // )));
185
- // let (io, _) = io::duplex(1);
186
- // inbound()
187
- // .with_stack(new_panic("detect stack must not be built"))
188
- // .push_accept(999, policies, new_ok())
189
- // .into_inner()
190
- // .new_service(Target(999))
191
- // .oneshot(io)
192
- // .await
193
- // .expect("should succeed");
194
- // }
126
+
127
+ #[ tokio:: test( flavor = "current_thread" ) ]
128
+ async fn default_allow ( ) {
129
+ let ( io, _) = io:: duplex ( 1 ) ;
130
+ let policies = Store :: for_test ( std:: iter:: once ( (
131
+ 1000 ,
132
+ ServerPolicy {
133
+ protocol : linkerd_proxy_server_policy:: Protocol :: Opaque ( Arc :: new ( [
134
+ Authorization {
135
+ authentication : Authentication :: Unauthenticated ,
136
+ networks : vec ! [ Default :: default ( ) ] ,
137
+ meta : Arc :: new ( Meta :: Resource {
138
+ group : "policy.linkerd.io" . into ( ) ,
139
+ kind : "serverauthorization" . into ( ) ,
140
+ name : "testsaz" . into ( ) ,
141
+ } ) ,
142
+ } ,
143
+ ] ) ) ,
144
+ meta : Arc :: new ( Meta :: Resource {
145
+ group : "policy.linkerd.io" . into ( ) ,
146
+ kind : "server" . into ( ) ,
147
+ name : "testsrv" . into ( ) ,
148
+ } ) ,
149
+ } ,
150
+ ) ) ) ;
151
+ inbound ( )
152
+ . with_stack ( new_ok ( ) )
153
+ . push_accept ( 999 , policies, new_panic ( "direct stack must not be built" ) )
154
+ . into_inner ( )
155
+ . new_service ( Target ( 1000 ) )
156
+ . oneshot ( io)
157
+ . await
158
+ . expect ( "should succeed" ) ;
159
+ }
160
+
161
+ #[ tokio:: test( flavor = "current_thread" ) ]
162
+ async fn direct ( ) {
163
+ let policies = Store :: for_test ( std:: iter:: once ( (
164
+ 1000 ,
165
+ ServerPolicy {
166
+ protocol : linkerd_proxy_server_policy:: Protocol :: Opaque ( Arc :: new ( [
167
+ Authorization {
168
+ authentication : Authentication :: Unauthenticated ,
169
+ networks : vec ! [ Default :: default ( ) ] ,
170
+ meta : Arc :: new ( Meta :: Resource {
171
+ group : "policy.linkerd.io" . into ( ) ,
172
+ kind : "serverauthorization" . into ( ) ,
173
+ name : "testsaz" . into ( ) ,
174
+ } ) ,
175
+ } ,
176
+ ] ) ) ,
177
+ meta : Arc :: new ( Meta :: Resource {
178
+ group : "policy.linkerd.io" . into ( ) ,
179
+ kind : "server" . into ( ) ,
180
+ name : "testsrv" . into ( ) ,
181
+ } ) ,
182
+ } ,
183
+ ) ) ) ;
184
+ let ( io, _) = io:: duplex ( 1 ) ;
185
+ inbound ( )
186
+ . with_stack ( new_panic ( "detect stack must not be built" ) )
187
+ . push_accept ( 999 , policies, new_ok ( ) )
188
+ . into_inner ( )
189
+ . new_service ( Target ( 999 ) )
190
+ . oneshot ( io)
191
+ . await
192
+ . expect ( "should succeed" ) ;
193
+ }
195
194
196
195
fn inbound ( ) -> Inbound < ( ) > {
197
196
Inbound :: new ( test_util:: default_config ( ) , test_util:: runtime ( ) . 0 )
0 commit comments