From 9610da3e5332a061d3f705cdacee1badf9a358f4 Mon Sep 17 00:00:00 2001 From: BenBirt Date: Mon, 28 Sep 2020 13:47:42 +0100 Subject: [PATCH] Refactor Snowflake parameters into flags, and revert those parameters to their defaults. (#1011) * Refactor Snowflake parameters into flags, and revert those parameters to their defaults. * turn off OCSP in cloud build * Revert "turn off OCSP in cloud build" This reverts commit 8259049c44c2c018c1a3e1da5bbf3bb96eab0657. * fixes --- api/BUILD | 1 + api/dbadapters/snowflake.ts | 13 ++++++++----- tests/integration/BUILD | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/api/BUILD b/api/BUILD index 1abb9e05a..02f828ba6 100644 --- a/api/BUILD +++ b/api/BUILD @@ -11,6 +11,7 @@ ts_library( deps = [ "//api/utils", "//common/errors", + "//common/flags", "//common/strings", "//core", "//protos:ts", diff --git a/api/dbadapters/snowflake.ts b/api/dbadapters/snowflake.ts index cd779d3b1..c1f05f073 100644 --- a/api/dbadapters/snowflake.ts +++ b/api/dbadapters/snowflake.ts @@ -7,11 +7,17 @@ import { IDbAdapter, IDbClient, OnCancel } from "df/api/dbadapters/index"; import { parseSnowflakeEvalError } from "df/api/utils/error_parsing"; import { LimitedResultSet } from "df/api/utils/results"; import { ErrorWithCause } from "df/common/errors/errors"; +import { Flags } from "df/common/flags"; import { collectEvaluationQueries, QueryOrAction } from "df/core/adapters"; import { dataform } from "df/protos/ts"; const HEARTBEAT_INTERVAL_SECONDS = 30; +const flags = { + snowflakeLogLevel: Flags.string("snowflake-log-level", "info"), + snowflakeUseOcsp: Flags.boolean("snowflake-use-ocsp", true) +}; + // This is horrible. However, it allows us to set the 'APPLICATION' parameter on client.environment, // which is passed all the way through to Snowflake's connection code. Pending a fix for // https://github.com/snowflakedb/snowflake-connector-nodejs/issues/100, this is the only way @@ -30,11 +36,8 @@ const snowflake = require("snowflake-sdk/lib/core")({ }) as ISnowflake; snowflake.configure({ - logLevel: "trace", - // Turn off OCSP checking. It appears as though timeouts in OCSP checks cause failed runs. - // See https://community.snowflake.com/s/case/5003r00001JuQrGAAV/snowflake-network-connectivity-problems - // for support ticket. - insecureConnect: true + logLevel: flags.snowflakeLogLevel.get(), + insecureConnect: !flags.snowflakeUseOcsp.get() }); interface ISnowflake { diff --git a/tests/integration/BUILD b/tests/integration/BUILD index 25ea4eb36..5716af97c 100644 --- a/tests/integration/BUILD +++ b/tests/integration/BUILD @@ -25,6 +25,7 @@ ts_test_suite( "//tests/integration/sqldatawarehouse_project:files", "//tests/integration/sqldatawarehouse_project:node_modules", ], + templated_args = ["--snowflake-use-ocsp=false"], deps = [ "//api", "//api/utils",