|
@@ -61,7 +61,9 @@ Y_UNIT_TEST_SUITE(S3AwsCredentials) {
|
|
|
AWS_ACCESS_KEY_ID_SECRET_NAME="id",
|
|
|
AWS_SECRET_ACCESS_KEY_SECRET_NAME="key",
|
|
|
AWS_REGION="ru-central-1"
|
|
|
- );)",
|
|
|
+ );
|
|
|
+ GRANT ALL ON `{external_source}` TO `root1@builtin`;
|
|
|
+ )",
|
|
|
"external_source"_a = externalDataSourceName,
|
|
|
"location"_a = "localhost:" + GetExternalPort("minio", "9000") + "/datalake/"
|
|
|
);
|
|
@@ -125,6 +127,64 @@ Y_UNIT_TEST_SUITE(S3AwsCredentials) {
|
|
|
UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnParser(0).GetUtf8(), "2");
|
|
|
UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnParser(1).GetUtf8(), "hello world");
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ auto db = kikimr->GetQueryClient(NYdb::NQuery::TClientSettings().AuthToken("root1@builtin"));
|
|
|
+ {
|
|
|
+ auto scriptExecutionOperation = db.ExecuteScript(fmt::format(R"(
|
|
|
+ SELECT * FROM `{external_source}`.`/a/` WITH (
|
|
|
+ format="json_each_row",
|
|
|
+ schema(
|
|
|
+ key Utf8 NOT NULL,
|
|
|
+ value Utf8 NOT NULL
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )", "external_source"_a = externalDataSourceName)).ExtractValueSync();
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL_C(scriptExecutionOperation.Status().GetStatus(), EStatus::SUCCESS, scriptExecutionOperation.Status().GetIssues().ToString());
|
|
|
+ UNIT_ASSERT(scriptExecutionOperation.Metadata().ExecutionId);
|
|
|
+
|
|
|
+ NYdb::NQuery::TScriptExecutionOperation readyOp = WaitScriptExecutionOperation(scriptExecutionOperation.Id(), kikimr->GetDriver());
|
|
|
+ UNIT_ASSERT_EQUAL_C(readyOp.Metadata().ExecStatus, EExecStatus::Failed, readyOp.Status().GetIssues().ToString());
|
|
|
+ UNIT_ASSERT_STRING_CONTAINS_C(readyOp.Status().GetIssues().ToString(), "secret with name 'id' not found", readyOp.Status().GetIssues().ToString());
|
|
|
+ }
|
|
|
+ {
|
|
|
+ const TString query = R"(
|
|
|
+ CREATE OBJECT `id:root1@builtin` (TYPE SECRET_ACCESS);
|
|
|
+ CREATE OBJECT `key:root1@builtin` (TYPE SECRET_ACCESS);
|
|
|
+ )";
|
|
|
+ auto result = session.ExecuteSchemeQuery(query).GetValueSync();
|
|
|
+ UNIT_ASSERT_C(result.GetStatus() == NYdb::EStatus::SUCCESS, result.GetIssues().ToString());
|
|
|
+ }
|
|
|
+ {
|
|
|
+ auto scriptExecutionOperation = db.ExecuteScript(fmt::format(R"(
|
|
|
+ SELECT * FROM `{external_source}`.`/a/` WITH (
|
|
|
+ format="json_each_row",
|
|
|
+ schema(
|
|
|
+ key Utf8 NOT NULL,
|
|
|
+ value Utf8 NOT NULL
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )", "external_source"_a = externalDataSourceName)).ExtractValueSync();
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL_C(scriptExecutionOperation.Status().GetStatus(), EStatus::SUCCESS, scriptExecutionOperation.Status().GetIssues().ToString());
|
|
|
+ UNIT_ASSERT(scriptExecutionOperation.Metadata().ExecutionId);
|
|
|
+
|
|
|
+ NYdb::NQuery::TScriptExecutionOperation readyOp = WaitScriptExecutionOperation(scriptExecutionOperation.Id(), kikimr->GetDriver());
|
|
|
+ UNIT_ASSERT_EQUAL_C(readyOp.Metadata().ExecStatus, EExecStatus::Completed, readyOp.Status().GetIssues().ToString());
|
|
|
+ TFetchScriptResultsResult results = db.FetchScriptResults(scriptExecutionOperation.Id(), 0).ExtractValueSync();
|
|
|
+ UNIT_ASSERT_C(results.IsSuccess(), results.GetIssues().ToString());
|
|
|
+
|
|
|
+ TResultSetParser resultSet(results.ExtractResultSet());
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnsCount(), 2);
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL(resultSet.RowsCount(), 2);
|
|
|
+ UNIT_ASSERT(resultSet.TryNextRow());
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnParser(0).GetUtf8(), "1");
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnParser(1).GetUtf8(), "trololo");
|
|
|
+ UNIT_ASSERT(resultSet.TryNextRow());
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnParser(0).GetUtf8(), "2");
|
|
|
+ UNIT_ASSERT_VALUES_EQUAL(resultSet.ColumnParser(1).GetUtf8(), "hello world");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|