diff --git a/ci/container/hang_webserver.py b/ci/container/hang_webserver.py index c8c6b0188..a650e964d 100755 --- a/ci/container/hang_webserver.py +++ b/ci/container/hang_webserver.py @@ -87,7 +87,7 @@ def stop(self): PORT = int(sys.argv[1]) - server = SimpleHttpServer('localhost', PORT) + server = SimpleHttpServer('127.0.0.1', PORT) print('HTTP Server Running on PORT {}..........'.format(PORT)) server.start() server.waitForThread() diff --git a/test/hangWebserver.js b/test/hangWebserver.js new file mode 100644 index 000000000..0db3a621c --- /dev/null +++ b/test/hangWebserver.js @@ -0,0 +1 @@ +module.exports.hangWebServerUrl = 'http://127.0.0.1:12345'; diff --git a/test/integration/testConnectionWithOCSP.js b/test/integration/testConnectionWithOCSP.js index c3ae6a363..51ac0db75 100644 --- a/test/integration/testConnectionWithOCSP.js +++ b/test/integration/testConnectionWithOCSP.js @@ -11,6 +11,7 @@ const OcspResponseCache = require('./../../lib/agent/ocsp_response_cache'); const sharedLogger = require('./sharedLogger'); const Logger = require('./../../lib/logger'); +const { hangWebServerUrl } = require('../hangWebserver'); Logger.getInstance().setLogger(sharedLogger.logger); let testCounter = 0; @@ -244,7 +245,7 @@ describe('Connection with OCSP test', function () // cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = true; // fake OCSP responder. - process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL = 'http://localhost:12345/hang'; + process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL = `${hangWebServerUrl}/hang`; process.env.SF_OCSP_TEST_OCSP_RESPONSE_CACHE_SERVER_TIMEOUT = 1000; snowflake.configure({ocspFailOpen: true}); @@ -280,7 +281,7 @@ describe('Connection with OCSP test', function () // cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = true; // fake OCSP responder. - process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL = 'http://localhost:12345/hang'; + process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL = `${hangWebServerUrl}/hang`; process.env.SF_OCSP_TEST_OCSP_RESPONSE_CACHE_SERVER_TIMEOUT = 1000; snowflake.configure({ocspFailOpen: false}); @@ -320,7 +321,7 @@ describe('Connection with OCSP test', function () // no cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = false; // fake OCSP responder. - process.env.SF_OCSP_RESPONDER_URL = 'http://localhost:12345/hang'; + process.env.SF_OCSP_RESPONDER_URL = `${hangWebServerUrl}/hang`; process.env.SF_OCSP_TEST_OCSP_RESPONDER_TIMEOUT = 1000; snowflake.configure({ocspFailOpen: true}); @@ -356,7 +357,7 @@ describe('Connection with OCSP test', function () // no cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = false; // fake OCSP responder. - process.env.SF_OCSP_RESPONDER_URL = 'http://localhost:12345/hang'; + process.env.SF_OCSP_RESPONDER_URL = `${hangWebServerUrl}/hang`; process.env.SF_OCSP_TEST_OCSP_RESPONDER_TIMEOUT = 1000; snowflake.configure({ocspFailOpen: false}); @@ -400,8 +401,8 @@ describe('Connection with OCSP test', function () // no cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = true; // fake OCSP responder. - process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL = 'http://localhost:12345/hang'; - process.env.SF_OCSP_RESPONDER_URL = 'http://localhost:12345/hang'; + process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL = `${hangWebServerUrl}/hang`; + process.env.SF_OCSP_RESPONDER_URL = `${hangWebServerUrl}/hang`; process.env.SF_OCSP_TEST_OCSP_RESPONDER_TIMEOUT = 1000; process.env.SF_OCSP_TEST_OCSP_RESPONSE_CACHE_SERVER_TIMEOUT = 1000; @@ -438,7 +439,7 @@ describe('Connection with OCSP test', function () // no cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = false; // fake OCSP responder. - process.env.SF_OCSP_RESPONDER_URL = 'http://localhost:12345/403'; + process.env.SF_OCSP_RESPONDER_URL = `${hangWebServerUrl}/403`; snowflake.configure({ocspFailOpen: false}); const connection = snowflake.createConnection(getConnectionOptions()); @@ -480,7 +481,7 @@ describe('Connection with OCSP test', function () // no cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = false; // fake OCSP responder. - process.env.SF_OCSP_RESPONDER_URL = 'http://localhost:12345/403'; + process.env.SF_OCSP_RESPONDER_URL = `${hangWebServerUrl}/403`; snowflake.configure({ocspFailOpen: true}); const connection = snowflake.createConnection(getConnectionOptions()); @@ -513,7 +514,7 @@ describe('Connection with OCSP test', function () // no cache server is used SocketUtil.variables.SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED = false; // fake OCSP responder. - process.env.SF_OCSP_RESPONDER_URL = 'http://localhost:12345/404'; + process.env.SF_OCSP_RESPONDER_URL = `${hangWebServerUrl}/404`; snowflake.configure({ocspFailOpen: false}); const connection = snowflake.createConnection(getConnectionOptions()); diff --git a/test/unit/large_result_set/testLargeResultSet.js b/test/unit/large_result_set/testLargeResultSet.js index 3f064ad0a..6790cf67b 100644 --- a/test/unit/large_result_set/testLargeResultSet.js +++ b/test/unit/large_result_set/testLargeResultSet.js @@ -3,14 +3,15 @@ const LargeResultSetService = require('../../../lib/services/large_result_set'); const httpClient = require('../../../lib/http/node'); const ConnectionConfig = require('../../../lib/connection/connection_config'); +const { hangWebServerUrl } = require('../../hangWebserver'); describe('LargeResultSetService', () => { let httpClientInstance; let largeResultSetService; - // it's python hang webserver address - const baseUrl = `http://127.0.0.1:12345`; + // it's python hang webserver address to test retries and errors + const baseUrl = hangWebServerUrl; beforeEach(() => {