@@ -9,11 +9,12 @@ use which::which;
9
9
10
10
#[ derive( PartialEq , Eq , Hash , Debug ) ]
11
11
pub enum DfsFeatures {
12
- SECURITY ,
13
- TOKEN ,
14
- PRIVACY ,
12
+ Security ,
13
+ DataTransferSecurity ,
14
+ Token ,
15
+ Privacy ,
15
16
HA ,
16
- VIEWFS ,
17
+ ViewFS ,
17
18
EC ,
18
19
RBF ,
19
20
}
@@ -23,10 +24,11 @@ impl DfsFeatures {
23
24
match self {
24
25
DfsFeatures :: EC => "ec" ,
25
26
DfsFeatures :: HA => "ha" ,
26
- DfsFeatures :: VIEWFS => "viewfs" ,
27
- DfsFeatures :: PRIVACY => "privacy" ,
28
- DfsFeatures :: SECURITY => "security" ,
29
- DfsFeatures :: TOKEN => "token" ,
27
+ DfsFeatures :: ViewFS => "viewfs" ,
28
+ DfsFeatures :: Privacy => "privacy" ,
29
+ DfsFeatures :: Security => "security" ,
30
+ DfsFeatures :: DataTransferSecurity => "data_transfer_security" ,
31
+ DfsFeatures :: Token => "token" ,
30
32
DfsFeatures :: RBF => "rbf" ,
31
33
}
32
34
}
@@ -35,9 +37,9 @@ impl DfsFeatures {
35
37
match value {
36
38
"ec" => Some ( DfsFeatures :: EC ) ,
37
39
"ha" => Some ( DfsFeatures :: HA ) ,
38
- "privacy" => Some ( DfsFeatures :: PRIVACY ) ,
39
- "security" => Some ( DfsFeatures :: SECURITY ) ,
40
- "token" => Some ( DfsFeatures :: TOKEN ) ,
40
+ "privacy" => Some ( DfsFeatures :: Privacy ) ,
41
+ "security" => Some ( DfsFeatures :: Security ) ,
42
+ "token" => Some ( DfsFeatures :: Token ) ,
41
43
_ => None ,
42
44
}
43
45
}
@@ -56,6 +58,12 @@ impl MiniDfs {
56
58
for feature in features. iter ( ) {
57
59
feature_args. push ( feature. as_str ( ) ) ;
58
60
}
61
+ // If the `token` feature is enabled, we need to force the data transfer protection
62
+ #[ cfg( feature = "token" ) ]
63
+ if !features. contains ( & DfsFeatures :: DataTransferSecurity ) {
64
+ feature_args. push ( DfsFeatures :: DataTransferSecurity . as_str ( ) ) ;
65
+ }
66
+
59
67
let mut child = Command :: new ( mvn_exec)
60
68
. args ( [
61
69
"-f" ,
@@ -86,7 +94,7 @@ impl MiniDfs {
86
94
// Make sure this doesn't care over from a token test to a non-token test
87
95
env:: remove_var ( "HADOOP_TOKEN_FILE_LOCATION" ) ;
88
96
89
- if features. contains ( & DfsFeatures :: SECURITY ) {
97
+ if features. contains ( & DfsFeatures :: Security ) {
90
98
let krb_conf = output. next ( ) . unwrap ( ) . unwrap ( ) ;
91
99
let kdestroy_exec = which ( "kdestroy" ) . expect ( "Failed to find kdestroy executable" ) ;
92
100
Command :: new ( kdestroy_exec) . spawn ( ) . unwrap ( ) . wait ( ) . unwrap ( ) ;
@@ -106,7 +114,7 @@ impl MiniDfs {
106
114
) ;
107
115
108
116
// If we testing token auth, set the path to the file and make sure we don't have an old kinit, otherwise kinit
109
- if features. contains ( & DfsFeatures :: TOKEN ) {
117
+ if features. contains ( & DfsFeatures :: Token ) {
110
118
env:: set_var ( "HADOOP_TOKEN_FILE_LOCATION" , "target/test/delegation_token" ) ;
111
119
} else {
112
120
let kinit_exec = which ( "kinit" ) . expect ( "Failed to find kinit executable" ) ;
@@ -120,7 +128,7 @@ impl MiniDfs {
120
128
}
121
129
}
122
130
123
- let url = if features. contains ( & DfsFeatures :: VIEWFS ) {
131
+ let url = if features. contains ( & DfsFeatures :: ViewFS ) {
124
132
"viewfs://minidfs-viewfs"
125
133
} else if features. contains ( & DfsFeatures :: RBF ) {
126
134
"hdfs://fed"
0 commit comments