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

define HOME in the tests so they work on all platforms #4123

Merged
merged 1 commit into from
Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Tasks/Common/securefiles-common/securefiles-common-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class SecureFileHelpers {
async downloadSecureFile(secureFileId: string) {
tl.debug('Mock downloadSecureFile with id = ' + secureFileId);
let fileName: string = secureFileId + '.filename';
let tempDownloadPath: string = tl.resolve(tl.getVariable('Agent.TempDirectory'), fileName);
let tempDownloadPath: string = '/build/temp/' + fileName;
return tempDownloadPath;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tr.setInput('deleteCert', 'true');
process.env['AGENT_VERSION'] = '2.116.0';
process.env['VSTS_TASKVARIABLE_APPLE_CERTIFICATE_KEYCHAIN'] = '/usr/lib/login.keychain';
process.env['VSTS_TASKVARIABLE_APPLE_CERTIFICATE_SHA1HASH'] = 'SHA1HASHOFP12CERTIFICATE';
process.env['HOME'] = '/users/test';

tr.registerMock('fs', {
readFileSync: fs.readFileSync,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tr.setInput('keychain', 'temp');

process.env['AGENT_VERSION'] = '2.116.0';
process.env['VSTS_TASKVARIABLE_APPLE_CERTIFICATE_KEYCHAIN'] = '/build/temp/ios_signing_temp.keychain';
process.env['HOME'] = '/users/test';

tr.registerMock('fs', {
existsSync: function (filePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tr.setInput('keychainPassword', 'mykeychainPwd');

process.env['AGENT_VERSION'] = '2.116.0';
process.env['AGENT_TEMPDIRECTORY'] = '/build/temp';
process.env['HOME'] = '/users/test';

let secureFileHelperMock = require('securefiles-common/securefiles-common-mock');
tr.registerMock('securefiles-common/securefiles-common', secureFileHelperMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tr.setInput('keychainPassword', 'mykeychainPwd');

process.env['AGENT_VERSION'] = '2.116.0';
process.env['AGENT_TEMPDIRECTORY'] = '/build/temp';
process.env['HOME'] = '/users/test';

let secureFileHelperMock = require('securefiles-common/securefiles-common-mock');
tr.registerMock('securefiles-common/securefiles-common', secureFileHelperMock);
Expand Down
2 changes: 1 addition & 1 deletion Tasks/InstallAppleProvisioningProfile/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('InstallAppleProvisioningProfile Suite', function () {

tr.run();

assert(tr.ran('/bin/rm -f /Users/madhurig/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision'),
assert(tr.ran('/bin/rm -f /users/test/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision'),
'provisioning profile should have been deleted.')
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ tr.setInput('removeProfile', 'true');

process.env['AGENT_VERSION'] = '2.116.0';
process.env['VSTS_TASKVARIABLE_APPLE_PROV_PROFILE_UUID'] = 'testuuid';
process.env['HOME'] = '/users/test';

tr.registerMock('fs', {
existsSync: function (pathToCheck) {
if (pathToCheck === '/Users/madhurig/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision') {
if (pathToCheck === '/users/test/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision') {
return true;
}
return false;
Expand All @@ -34,10 +35,10 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
},
"exist": {
"/build/temp/mySecureFileId.filename": true,
"/Users/madhurig/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision": true
"/users/test/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision": true
},
"exec": {
"/bin/rm -f /Users/madhurig/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision": {
"/bin/rm -f /users/test/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision": {
"code": 0,
"stdout": "delete output here"
}
Expand Down
4 changes: 2 additions & 2 deletions Tasks/InstallAppleProvisioningProfile/Tests/L0SecureFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);
tr.setInput('provProfileSecureFile', 'mySecureFileId');

process.env['AGENT_VERSION'] = '2.116.0';
process.env['AGENT_TEMPDIRECTORY'] = '/build/temp';
process.env['HOME'] = '/users/test';

let secureFileHelperMock = require('securefiles-common/securefiles-common-mock');
tr.registerMock('securefiles-common/securefiles-common', secureFileHelperMock);
Expand Down Expand Up @@ -45,7 +45,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"code": 0,
"stdout": "testuuid"
},
"/bin/cp -f /build/temp/mySecureFileId.filename /Users/madhurig/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision": {
"/bin/cp -f /build/temp/mySecureFileId.filename /users/test/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision": {
"code": 0,
"stdout": "provisioning profile copied"
},
Expand Down