2 using System.Collections.Generic;
16 private bool _disposed =
false;
21 public static (
string url,
string username,
string password) GetConnectionConfig()
23 var
url = Environment.GetEnvironmentVariable(
"KINETICA_URL") ??
"http://localhost:9191";
24 var username = Environment.GetEnvironmentVariable(
"KINETICA_USER") ??
"admin";
25 var password = Environment.GetEnvironmentVariable(
"KINETICA_PASSWORD") ??
"secret";
27 return (
url, username, password);
36 var (
url, username, password) = GetConnectionConfig();
51 var dropSql = $
"DROP SCHEMA IF EXISTS {SchemaName} CASCADE";
52 Kinetica.executeSql(dropSql, 0, -9999);
59 var schemaOptions =
new Dictionary<string, string>
61 {
"no_error_if_exists",
"true" }
67 throw new Exception($
"Failed to create test schema '{SchemaName}': {ex.Message}", ex);
76 return $
"{SchemaName}.{tableName}";
86 var dropSql = $
"DROP SCHEMA IF EXISTS {SchemaName} CASCADE";
87 Kinetica.executeSql(dropSql, 0, -9999);
111 const string chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
112 var result =
new char[length];
113 for (
int i = 0; i < length; i++)
115 result[i] = chars[_random.Next(chars.Length)];
117 return new string(result);
122 return _random.Next();
127 return _random.NextDouble();
void Cleanup()
Cleanup - drop the test schema.
string? Username
Optional: User Name for Kinetica security
static double RandomDouble()
Test context that manages schema and cleanup for integration tests.
TestContext(string testName)
Create a new test context with an isolated schema.
Data generators for testing.
static string RandomString(int length)
Failover to clusters in a random order (default)
static string url
Get connection configuration from environment variables.
string QualifiedTable(string tableName)
Get a qualified table name (schema.table).
API to talk to Kinetica Database