Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-863058: Explicitly set hang webserver address #568

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/container/hang_webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions test/hangWebserver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports.hangWebServerUrl = 'http://127.0.0.1:12345';
19 changes: 10 additions & 9 deletions test/integration/testConnectionWithOCSP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
5 changes: 3 additions & 2 deletions test/unit/large_result_set/testLargeResultSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() =>
{
Expand Down
Loading