Skip to content

Commit c97a9d1

Browse files
committed
LOC-7325: make the LocalBinary Download tests actually run
The three Download tests could never pass. `binary.key` was never set, though binaryPath() sets it before every real download() call, so the source-url fetch was rejected with "Invalid auth token". `retries` was omitted too, making the retry check `undefined > 0` — every failure went straight to the terminal branch with no retry. On master this block hangs rather than fails, because the terminal path there never invokes the callback; that defect was fixed earlier in this branch, which turned the hang into a fast assertion failure and made the real cause visible. With the key supplied the block passes for the first time, covering the real HTTP download end to end — direct and through a proxy, async and sync — which is what exercises the new non-200 response check against a live source. Verified with real credentials: full suite 59 passing, 1 failing. The one failure (`should stop local`) fails identically on origin/master.
1 parent 69bd942 commit c97a9d1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

test/local.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ describe('LocalBinary', function () {
451451

452452
beforeEach(function () {
453453
binary = new LocalBinary();
454+
// binaryPath() normally sets this before calling download(); without it
455+
// the source-url fetch is rejected with "Invalid auth token" and the
456+
// download can never succeed, so these tests could not pass.
457+
binary.key = process.env.BROWSERSTACK_ACCESS_KEY;
454458
tempDownloadPath = path.join(process.cwd(), 'download');
455459
});
456460

@@ -465,7 +469,7 @@ describe('LocalBinary', function () {
465469
check(done, function(){
466470
expect(fs.existsSync(result)).to.equal(true);
467471
});
468-
});
472+
}, binary.baseRetries);
469473
});
470474

471475
it('should download binaries with proxy', function (done) {
@@ -479,13 +483,13 @@ describe('LocalBinary', function () {
479483
check(done, function(){
480484
expect(fs.existsSync(result)).to.equal(true);
481485
});
482-
});
486+
}, binary.baseRetries);
483487
});
484488

485489
it('should download binaries in sync', function () {
486490
this.timeout(MAX_TIMEOUT);
487491
var conf = {};
488-
const result = binary.downloadSync(conf, tempDownloadPath);
492+
const result = binary.downloadSync(conf, tempDownloadPath, binary.baseRetries);
489493
expect(fs.existsSync(result)).to.equal(true);
490494
});
491495
});

0 commit comments

Comments
 (0)