Skip to content

Commit

Permalink
Merge branch 'master' into SNOW-1820372
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy authored Dec 12, 2024
2 parents f12f124 + 34c0683 commit 7bf600a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
fail-fast: false
matrix:
cloud: [ 'AWS', 'AZURE', 'GCP' ]
nodeVersion: [ '14.x', '16.x', '18.x', '20.x', '22.x']
nodeVersion: ['18.x', '20.x', '22.x']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
fail-fast: false
matrix:
cloud: [ 'AWS', 'AZURE', 'GCP' ]
nodeVersion: [ '14.x', '16.x', '18.x', '20.x', '22.x']
nodeVersion: ['18.x', '20.x', '22.x']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
7 changes: 0 additions & 7 deletions ci/container/test_component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ npm install
PACKAGE_NAME=$(cd $WORKSPACE && ls snowflake-sdk*.tgz)
npm install $WORKSPACE/${PACKAGE_NAME}

# Since @azure lib has lost compatibility with node14
#some dependencies have to be replaced by an older version
nodeVersion=$(node -v)
if [[ "$nodeVersion" == 'v14.'* ]]; then
npm install @azure/[email protected]
fi

echo "[INFO] Setting test parameters"
if [[ "$LOCAL_USER_NAME" == "jenkins" ]]; then
echo "[INFO] Use the default test parameters.json"
Expand Down
8 changes: 0 additions & 8 deletions ci/test_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ echo [INFO] Installing Snowflake NodeJS Driver
copy %GITHUB_WORKSPACE%\artifacts\* .
for %%f in (snowflake-sdk*.tgz) do cmd /c npm install %%f

REM Since @azure lib has lost compatibility with node14
REM some dependencies have to be replaced by an older version
FOR /F "tokens=* USEBACKQ" %%F IN (`node -v`) DO (
SET nodeVersion=%%F
)
ECHO %nodeVersion%
if not x%nodeVersion:v14.=%==x%str1% cmd /c npm install @azure/core-lro@2.6.0

if %ERRORLEVEL% NEQ 0 (
echo [ERROR] failed to install the Snowflake NodeJS Driver
exit /b 1
Expand Down
54 changes: 23 additions & 31 deletions test/unit/authentication/json_credential_manager_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,29 @@ const credType = 'mock_cred';
const key = Util.buildCredentialCacheKey(host, user, credType);
const randomPassword = randomUUID();
const os = require('os');
const currentNodeVersion = parseInt(process.version.slice(1), 10);

if (!(currentNodeVersion <= 14 && (os.platform() === 'win32'))) {
describe('Json credential manager test', function () {
const credentialManager = new JsonCredentialManager();

it('test - initiate credential manager', async function () {
if (await credentialManager.read(key) !== null) {
await credentialManager.remove(key);
}
const savedPassword = await credentialManager.read(key);

assert.strictEqual(await credentialManager.getTokenDir(), path.join(os.homedir(), 'temporary_credential.json'));
assert.strictEqual(savedPassword, null);
});

it('test - write the mock credential with the credential manager', async function () {
await credentialManager.write(key, randomPassword);
const result = await credentialManager.read(key);
assert.strictEqual(randomPassword, result);
});

it('test - delete the mock credential with the credential manager', async function () {
describe('Json credential manager test', function () {
const credentialManager = new JsonCredentialManager();
it('test - initiate credential manager', async function () {
if (await credentialManager.read(key) !== null) {
await credentialManager.remove(key);
const result = await credentialManager.read(key);
assert.ok(result === null);
});

it('test - token saving location when the user sets credentialCacheDir value', async function () {
const credManager = new JsonCredentialManager(os.tmpdir());
assert.strictEqual(await credManager.getTokenDir(), path.join(os.tmpdir(), 'temporary_credential.json'));
});
}
const savedPassword = await credentialManager.read(key);
assert.strictEqual(await credentialManager.getTokenDir(), path.join(os.homedir(), 'temporary_credential.json'));
assert.strictEqual(savedPassword, null);
});
it('test - write the mock credential with the credential manager', async function () {
await credentialManager.write(key, randomPassword);
const result = await credentialManager.read(key);
assert.strictEqual(randomPassword, result);
});
it('test - delete the mock credential with the credential manager', async function () {
await credentialManager.remove(key);
const result = await credentialManager.read(key);
assert.ok(result === null);
});
it('test - token saving location when the user sets credentialCacheDir value', async function () {
const credManager = new JsonCredentialManager(os.tmpdir());
assert.strictEqual(await credManager.getTokenDir(), path.join(os.tmpdir(), 'temporary_credential.json'));
});
}
});

0 comments on commit 7bf600a

Please sign in to comment.