jduo commented on code in PR #1592: URL: https://github.com/apache/arrow-adbc/pull/1592#discussion_r1515958197
########## csharp/test/Drivers/Interop/Snowflake/ErrorHandlingTests.cs: ########## @@ -0,0 +1,293 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using Xunit; +using Xunit.Abstractions; + +namespace Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake +{ + // TODO: When supported, use prepared statements instead of SQL string literals + // Which will better test how the driver handles values sent/received + + public class ErrorHandlingTests : IDisposable + { + private const string TestTablePrefix = "ADBCERRORSTEST_"; // Make configurable? Also; must be all caps if not double quoted + private const string DefaultColumnName = "COLUMN_NAME"; + private const string DefaultColumnNameLower = "column_name"; + readonly SnowflakeTestConfiguration _snowflakeTestConfiguration; + readonly AdbcConnection _connection; + readonly AdbcStatement _statement; + readonly string _catalogSchema; + private readonly ITestOutputHelper _output; + private bool _disposedValue = false; + + /// <summary> + /// Validates that specific errors are generated as expected. + /// </summary> + public ErrorHandlingTests(ITestOutputHelper output) + { + Skip.IfNot(Utils.CanExecuteTestConfig(SnowflakeTestingUtils.SNOWFLAKE_TEST_CONFIG_VARIABLE)); + _snowflakeTestConfiguration = SnowflakeTestingUtils.TestConfiguration; + Dictionary<string, string> options = []; + AdbcDriver snowflakeDriver = SnowflakeTestingUtils.GetSnowflakeAdbcDriver(_snowflakeTestConfiguration, out Dictionary<string, string> parameters); + AdbcDatabase adbcDatabase = snowflakeDriver.Open(parameters); + _connection = adbcDatabase.Connect(options); + _statement = _connection.CreateStatement(); + _catalogSchema = string.Format("{0}.{1}", _snowflakeTestConfiguration.Metadata.Catalog, _snowflakeTestConfiguration.Metadata.Schema); + _output = output; + } + + /// <summary> + /// Tests for invalid table and column names + /// </summary> + [SkippableTheory] + [InlineData("NUMERIC", "0", "INVALID_TABLE_NAME", null, new[] { "[Snowflake] 002003 (42S02)", "SQL compilation error", "Object 'INVALID_TABLE_NAME' does not exist or not authorized" })] Review Comment: Should we actually validate AdbcException error codes and vendor codes as well as the error message? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
