Skip to content

Commit 75f5ea6

Browse files
authored
Merge pull request #202 from dhensby/fix/sqlcmd-timeout
fix: add login timeout to sqlcmd in waitForDatabase
2 parents 2dc24a2 + b18a49f commit 75f5ea6

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

lib/main/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export function waitForDatabase(password: string) {
103103
'sa',
104104
'-P',
105105
password,
106+
'-l',
107+
'5',
106108
'-Q',
107109
'SELECT @@VERSION',
108110
], {

test/utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import * as io from '@actions/io';
88
import * as glob from '@actions/glob';
99
import * as http from '@actions/http-client';
1010
import { Globber } from '@actions/glob';
11-
import { stub, restore, SinonStubbedMember, SinonStubbedInstance, SinonStub, createStubInstance } from 'sinon';
11+
import { stub, restore, match, SinonStubbedMember, SinonStubbedInstance, SinonStub, createStubInstance } from 'sinon';
1212
import { expect, use } from 'chai';
1313
import sinonChai from 'sinon-chai';
1414
import * as utils from '../src/utils';
@@ -204,6 +204,14 @@ describe('utils', () => {
204204
const res = await utils.waitForDatabase('password');
205205
expect(res).to.equal(0);
206206
});
207+
it('passes a login timeout to sqlcmd', async () => {
208+
await utils.waitForDatabase('password');
209+
expect(exec.exec).to.have.been.calledWith(
210+
'sqlcmd',
211+
match.array.contains(['-l', '5']),
212+
match.any,
213+
);
214+
});
207215
});
208216
describe('.downloadBoxInstaller()', () => {
209217
beforeEach('stub deps', () => {

0 commit comments

Comments
 (0)