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

Use mc-fus in AppCenterDistributeV2 #13353

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
84 changes: 29 additions & 55 deletions Tasks/AppCenterDistributeV2/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as assert from 'assert';
import * as ttm from 'vsts-task-lib/mock-test';

describe('AppCenterDistribute L0 Suite', function () {
const timeout = 6000;

before(() => {
//Enable this for output
//process.env['TASK_TEST_TRACE'] = 1;
Expand All @@ -26,181 +28,153 @@ describe('AppCenterDistribute L0 Suite', function () {
});

it('Positive path: upload one ipa file', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0OneIpaPass.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Negative path: can not upload multiple files', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0MultipleIpaFail.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.failed, 'task should have failed');
});

it('Negative path: cannot continue upload without symbols', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0NoSymbolsFails.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.failed, 'task should have failed');
});

it('Postiive path: can continue upload without symbols if variable VSMobileCenterUpload.ContinueIfSymbolsNotFound is true', function () {
this.timeout(4000);
it('Negative path: failed when HTTP status is not 2xx', function () {
this.timeout(timeout);
let tp = path.join(__dirname, 'L0FailsHttpStatusNot2xx.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Postiive path: can continue upload without symbols if variable VSMobileCenterUpload.ContinueIfSymbolsNotFound is true', function () {
this.timeout(timeout);
let tp = path.join(__dirname, 'L0NoSymbolsConditionallyPass.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Negative path: mobile center api rejects fail the task', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0ApiRejectsFail.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.failed, 'task should have failed');
});

it('Positive path: single file with Include Parent', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymIncludeParent.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: multiple dSYMs in the same folder', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymMultipleDSYMs_flat_1.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: multiple dSYMs in parallel folders', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymMultipleDSYMs_flat_2.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: multiple dSYMs in a tree', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymMultipleDSYMs_tree.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: a single dSYM', function () {
this.timeout(6000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymMultipleDSYMs_single.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: a single PDB', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymPDBs_single.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});


it('Positive path: multiple PDBs', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0SymPDBs_multiple.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: publish commit info (including commit message)', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0PublishCommitInfo_1.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: publish commit info (excluding commit message)', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0PublishCommitInfo_2.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: publish commit info for feature branch', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0PublishCommitInfo_3.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: publish commit info for tfvc branch', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0PublishCommitInfo_4.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: publish mandatory update', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0PublishMandatoryUpdate.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});

it('Positive path: publish multiple destinations', function () {
this.timeout(4000);

this.timeout(timeout);
let tp = path.join(__dirname, 'L0PublishMultipleDestinations.js');
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();
assert(tr.succeeded, 'task should have succeeded');
});
Expand Down
7 changes: 2 additions & 5 deletions Tasks/AppCenterDistributeV2/Tests/L0ApiRejectsFail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import ma = require('vsts-task-lib/mock-answer');
import tmrm = require('vsts-task-lib/mock-run');
import path = require('path');
import fs = require('fs');
var Readable = require('stream').Readable

var nock = require('nock');

Expand All @@ -16,9 +14,9 @@ tmr.setInput('app', '/test/path/to/my.ipa');
tmr.setInput('releaseNotesSelection', 'releaseNotesInput');
tmr.setInput('releaseNotesInput', 'my release notes');

//prepare upload
nock('https://example.test')
.post('/v0.1/apps/testuser/testapp/package_uploads')
.post('/v0.1/apps/testuser/testapp/uploads/releases')
.query(true)
.reply(403);

// provide answers for task mock
Expand All @@ -33,6 +31,5 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}
};
tmr.setAnswers(a);

tmr.run();

Loading