Tests
| 314 | |
| 315 | // Tests |
| 316 | TEST_P(ClickHouseIntegrationTest, CreateTableForGithubEvents) { |
| 317 | if (!use_real_api_) { |
| 318 | GTEST_SKIP() << "No API key set for " << GetParam(); |
| 319 | } |
| 320 | |
| 321 | std::string table_name = "github_events_" + table_suffix_; |
| 322 | |
| 323 | // Clean up any existing table |
| 324 | clickhouse_client_->Execute("DROP TABLE IF EXISTS " + test_db_name_ + "." + |
| 325 | table_name); |
| 326 | clickhouse_client_->Execute("DROP TABLE IF EXISTS default." + table_name); |
| 327 | |
| 328 | std::string sql = executeSQLGeneration("create a table named " + table_name + |
| 329 | " for github events in " + |
| 330 | test_db_name_ + " database"); |
| 331 | |
| 332 | // Execute the generated SQL |
| 333 | ASSERT_NO_THROW(clickhouse_client_->Execute("USE " + test_db_name_)); |
| 334 | ASSERT_NO_THROW(clickhouse_client_->Execute(sql)); |
| 335 | |
| 336 | // Verify table was created |
| 337 | bool table_exists = false; |
| 338 | clickhouse_client_->Select( |
| 339 | "EXISTS TABLE " + test_db_name_ + "." + table_name, |
| 340 | [&table_exists](const clickhouse::Block& block) { |
| 341 | if (block.GetRowCount() > 0) { |
| 342 | table_exists = block[0]->As<clickhouse::ColumnUInt8>()->At(0); |
| 343 | } |
| 344 | }); |
| 345 | EXPECT_TRUE(table_exists); |
| 346 | } |
| 347 | |
| 348 | TEST_P(ClickHouseIntegrationTest, InsertAndQueryData) { |
| 349 | if (!use_real_api_) { |
nothing calls this directly
no outgoing calls
no test coverage detected