@@ -62,6 +62,25 @@ suite("test_alter_s3_vault", "nonConcurrent") {
62
62
"""
63
63
}, " Alter property" )
64
64
65
+ expectExceptionLike({
66
+ sql """
67
+ ALTER STORAGE VAULT ${ suiteName}
68
+ PROPERTIES (
69
+ "type"="S3",
70
+ "s3.access_key" = "new_ak"
71
+ );
72
+ """
73
+ }, " Alter property" )
74
+
75
+ expectExceptionLike({
76
+ sql """
77
+ ALTER STORAGE VAULT ${ suiteName}
78
+ PROPERTIES (
79
+ "type"="S3",
80
+ "s3.secret_key" = "new_sk"
81
+ );
82
+ """
83
+ }, " Alter property" )
65
84
66
85
def vaultName = suiteName
67
86
String properties;
@@ -75,28 +94,105 @@ suite("test_alter_s3_vault", "nonConcurrent") {
75
94
}
76
95
}
77
96
78
- def newVaultName = suiteName + " _new" ;
97
+ // alter ak sk
98
+ sql """
99
+ ALTER STORAGE VAULT ${ vaultName}
100
+ PROPERTIES (
101
+ "type"="S3",
102
+ "s3.access_key" = "${ getS3AK()} ",
103
+ "s3.secret_key" = "${ getS3SK()} "
104
+ );
105
+ """
106
+
107
+ vaultInfos = sql """ SHOW STORAGE VAULT;"""
108
+
109
+ for (int i = 0 ; i < vaultInfos. size(); i++ ) {
110
+ def name = vaultInfos[i][0 ]
111
+ logger. info(" name is ${ name} , info ${ vaultInfos[i]} " )
112
+ if (name. equals(vaultName)) {
113
+ assert properties == newProperties, " Properties are not the same"
114
+ }
115
+ }
116
+
117
+ sql """ insert into alter_s3_vault_tbl values("2", "2"); """
118
+
119
+
120
+ // rename
121
+ newVaultName = vaultName + " _new" ;
122
+
123
+ sql """
124
+ ALTER STORAGE VAULT ${ vaultName}
125
+ PROPERTIES (
126
+ "type"="S3",
127
+ "VAULT_NAME" = "${ newVaultName} "
128
+ );
129
+ """
130
+
131
+ vaultInfos = sql """ SHOW STORAGE VAULT;"""
132
+ for (int i = 0 ; i < vaultInfos. size(); i++ ) {
133
+ def name = vaultInfos[i][0 ]
134
+ logger. info(" name is ${ name} , info ${ vaultInfos[i]} " )
135
+ if (name. equals(newVaultName)) {
136
+ assert properties == newProperties, " Properties are not the same"
137
+ }
138
+ if (name. equals(vaultName)) {
139
+ assertTrue (false );
140
+ }
141
+ }
142
+
143
+ sql """ insert into alter_s3_vault_tbl values("2", "2"); """
144
+
145
+ // rename + aksk
146
+ vaultName = newVaultName
79
147
80
148
sql """
81
149
ALTER STORAGE VAULT ${ vaultName}
82
150
PROPERTIES (
83
151
"type"="S3",
84
152
"VAULT_NAME" = "${ newVaultName} ",
85
- "s3.access_key" = "new_ak"
153
+ "s3.access_key" = "${ getS3AK()} ",
154
+ "s3.secret_key" = "${ getS3SK()} "
86
155
);
87
156
"""
88
157
158
+ vaultInfos = sql """ SHOW STORAGE VAULT;"""
159
+ for (int i = 0 ; i < vaultInfos. size(); i++ ) {
160
+ def name = vaultInfos[i][0 ]
161
+ logger. info(" name is ${ name} , info ${ vaultInfos[i]} " )
162
+ if (name. equals(newVaultName)) {
163
+ assert properties == newProperties, " Properties are not the same"
164
+ }
165
+ if (name. equals(vaultName)) {
166
+ assertTrue (false );
167
+ }
168
+ }
169
+ sql """ insert into alter_s3_vault_tbl values("2", "2"); """
170
+
171
+
172
+ vaultName = newVaultName;
173
+ newVaultName = vaultName + " _new" ;
174
+
89
175
vaultInfos = sql """ SHOW STORAGE VAULT;"""
90
176
boolean exist = false
91
177
178
+ sql """
179
+ ALTER STORAGE VAULT ${ vaultName}
180
+ PROPERTIES (
181
+ "type"="S3",
182
+ "VAULT_NAME" = "${ newVaultName} ",
183
+ "s3.access_key" = "new_ak_ak",
184
+ "s3.secret_key" = "sk"
185
+ );
186
+ """
187
+
92
188
for (int i = 0 ; i < vaultInfos. size(); i++ ) {
93
189
def name = vaultInfos[i][0 ]
94
190
logger. info(" name is ${ name} , info ${ vaultInfos[i]} " )
95
191
if (name. equals(vaultName)) {
96
192
assertTrue (false );
97
193
}
98
194
if (name. equals(newVaultName)) {
99
- assertTrue (vaultInfos[i][2 ]. contains(" new_ak " ))
195
+ assertTrue (vaultInfos[i][2 ]. contains(" new_ak_ak " ))
100
196
exist = true
101
197
}
102
198
}
0 commit comments