Skip to content

Commit

Permalink
feat: fewer scratch org timeouts
Browse files Browse the repository at this point in the history
* feat: fewer scratchorg timeouts

* test: ut with longer wait

* style: typo
  • Loading branch information
mshanemc authored Oct 6, 2022
1 parent 33522df commit 0644f9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/testSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ export class TestSession extends AsyncOptionalCreatable<TestSessionOptions> {

if (org.wait) {
baseCmd += ` -w ${org.wait}`;
} else {
baseCmd += ' -w 60';
}

const rv = shell.exec(baseCmd, this.shelljsExecOptions) as shell.ShellString;
Expand Down
10 changes: 6 additions & 4 deletions test/unit/testSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ describe('TestSession', () => {
// expect exec to be called on every retry attempt AND the initial attempt
expect(execStub.callCount).to.equal(scratchOrgs.length * (retries + 1));
expect(session.orgs.get(username)).to.deep.equal({ username, orgId: '12345' });
expect(execStub.firstCall.args[0]).to.equal('sf env create scratch --json -f config/project-scratch-def.json');
expect(execStub.firstCall.args[0]).to.equal(
'sf env create scratch --json -f config/project-scratch-def.json -w 60'
);
});

it('should create a session with org creation', async () => {
Expand Down Expand Up @@ -213,7 +215,7 @@ describe('TestSession', () => {
expect(session.orgs.get(username)).to.deep.equal({ username, orgId: '12345' });
expect(session.orgs.get('default')).to.deep.equal({ username, orgId: '12345' });
expect(execStub.firstCall.args[0]).to.equal(
'sf env create scratch --json -f config/project-scratch-def.json -a my-org -y 1 -d -e developer'
'sf env create scratch --json -f config/project-scratch-def.json -a my-org -y 1 -d -e developer -w 60'
);
expect(process.env.HOME).to.equal(session.homeDir);
expect(process.env.USERPROFILE).to.equal(session.homeDir);
Expand Down Expand Up @@ -254,7 +256,7 @@ describe('TestSession', () => {

it('should error if setup command fails', async () => {
stubMethod(sandbox, shelljs, 'which').returns(true);
const expectedCmd = 'sf env create scratch --json -f config/project-scratch-def.json';
const expectedCmd = 'sf env create scratch --json -f config/project-scratch-def.json -w 60';
const execRv = 'Cannot foo before bar';
const shellString = new ShellString(JSON.stringify(execRv));
shellString.code = 1;
Expand Down Expand Up @@ -356,7 +358,7 @@ describe('TestSession', () => {

it('should not remove the test session dir when overridden', async () => {
// @ts-ignore
session.overriddenDir = 'overriden';
session.overriddenDir = 'overridden';

await session.clean();

Expand Down

0 comments on commit 0644f9f

Please sign in to comment.