@@ -61,7 +61,9 @@ Y_UNIT_TEST_SUITE(S3AwsCredentials) {
61
61
AWS_ACCESS_KEY_ID_SECRET_NAME="id",
62
62
AWS_SECRET_ACCESS_KEY_SECRET_NAME="key",
63
63
AWS_REGION="ru-central-1"
64
- );)" ,
64
+ );
65
+ GRANT ALL ON `{external_source}` TO `root1@builtin`;
66
+ )" ,
65
67
" external_source" _a = externalDataSourceName,
66
68
" location" _a = " localhost:" + GetExternalPort (" minio" , " 9000" ) + " /datalake/"
67
69
);
@@ -125,6 +127,64 @@ Y_UNIT_TEST_SUITE(S3AwsCredentials) {
125
127
UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnParser (0 ).GetUtf8 (), " 2" );
126
128
UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnParser (1 ).GetUtf8 (), " hello world" );
127
129
}
130
+
131
+ {
132
+ auto db = kikimr->GetQueryClient (NYdb::NQuery::TClientSettings ().AuthToken (" root1@builtin" ));
133
+ {
134
+ auto scriptExecutionOperation = db.ExecuteScript (fmt::format (R"(
135
+ SELECT * FROM `{external_source}`.`/a/` WITH (
136
+ format="json_each_row",
137
+ schema(
138
+ key Utf8 NOT NULL,
139
+ value Utf8 NOT NULL
140
+ )
141
+ )
142
+ )" , " external_source" _a = externalDataSourceName)).ExtractValueSync ();
143
+ UNIT_ASSERT_VALUES_EQUAL_C (scriptExecutionOperation.Status ().GetStatus (), EStatus::SUCCESS, scriptExecutionOperation.Status ().GetIssues ().ToString ());
144
+ UNIT_ASSERT (scriptExecutionOperation.Metadata ().ExecutionId );
145
+
146
+ NYdb::NQuery::TScriptExecutionOperation readyOp = WaitScriptExecutionOperation (scriptExecutionOperation.Id (), kikimr->GetDriver ());
147
+ UNIT_ASSERT_EQUAL_C (readyOp.Metadata ().ExecStatus , EExecStatus::Failed, readyOp.Status ().GetIssues ().ToString ());
148
+ UNIT_ASSERT_STRING_CONTAINS_C (readyOp.Status ().GetIssues ().ToString (), " secret with name 'id' not found" , readyOp.Status ().GetIssues ().ToString ());
149
+ }
150
+ {
151
+ const TString query = R"(
152
+ CREATE OBJECT `id:root1@builtin` (TYPE SECRET_ACCESS);
153
+ CREATE OBJECT `key:root1@builtin` (TYPE SECRET_ACCESS);
154
+ )" ;
155
+ auto result = session.ExecuteSchemeQuery (query).GetValueSync ();
156
+ UNIT_ASSERT_C (result.GetStatus () == NYdb::EStatus::SUCCESS, result.GetIssues ().ToString ());
157
+ }
158
+ {
159
+ auto scriptExecutionOperation = db.ExecuteScript (fmt::format (R"(
160
+ SELECT * FROM `{external_source}`.`/a/` WITH (
161
+ format="json_each_row",
162
+ schema(
163
+ key Utf8 NOT NULL,
164
+ value Utf8 NOT NULL
165
+ )
166
+ )
167
+ )" , " external_source" _a = externalDataSourceName)).ExtractValueSync ();
168
+ UNIT_ASSERT_VALUES_EQUAL_C (scriptExecutionOperation.Status ().GetStatus (), EStatus::SUCCESS, scriptExecutionOperation.Status ().GetIssues ().ToString ());
169
+ UNIT_ASSERT (scriptExecutionOperation.Metadata ().ExecutionId );
170
+
171
+ NYdb::NQuery::TScriptExecutionOperation readyOp = WaitScriptExecutionOperation (scriptExecutionOperation.Id (), kikimr->GetDriver ());
172
+ UNIT_ASSERT_EQUAL_C (readyOp.Metadata ().ExecStatus , EExecStatus::Completed, readyOp.Status ().GetIssues ().ToString ());
173
+ TFetchScriptResultsResult results = db.FetchScriptResults (scriptExecutionOperation.Id (), 0 ).ExtractValueSync ();
174
+ UNIT_ASSERT_C (results.IsSuccess (), results.GetIssues ().ToString ());
175
+
176
+ TResultSetParser resultSet (results.ExtractResultSet ());
177
+ UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnsCount (), 2 );
178
+ UNIT_ASSERT_VALUES_EQUAL (resultSet.RowsCount (), 2 );
179
+ UNIT_ASSERT (resultSet.TryNextRow ());
180
+ UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnParser (0 ).GetUtf8 (), " 1" );
181
+ UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnParser (1 ).GetUtf8 (), " trololo" );
182
+ UNIT_ASSERT (resultSet.TryNextRow ());
183
+ UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnParser (0 ).GetUtf8 (), " 2" );
184
+ UNIT_ASSERT_VALUES_EQUAL (resultSet.ColumnParser (1 ).GetUtf8 (), " hello world" );
185
+ }
186
+ }
187
+
128
188
}
129
189
}
130
190
0 commit comments