Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
[JENKINS-36660] using async series to make sure the changeset has pas…
Browse files Browse the repository at this point in the history
…sed before doing next step
  • Loading branch information
scherler committed Aug 30, 2016
1 parent 977cc12 commit 12a0917
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -31,5 +31,8 @@
"xmlhttprequest": "1.8.0",
"fs-extra": "^0.30.0",
"nodegit": "^0.13.2"
},
"dependencies": {
"async": "^2.0.1"
}
}
1 change: 1 addition & 0 deletions src/main/js/api/git.js
Expand Up @@ -146,6 +146,7 @@ exports.createCommit = function (pathToRepo, files) {
})
.done(function (commitId) {
console.log("New Commit: ", commitId);
return commitId;
});

};
40 changes: 26 additions & 14 deletions src/test/js/edgeCases/folder.js
@@ -1,12 +1,14 @@
const git = require("../../../main/js/api/git");
const path = require("path");
var fse = require('fs-extra');
const fse = require('fs-extra');
const async = require("async");

const folders = ['firstFolder', '三百', 'ñba', '七'];
const anotherFolders = ['anotherFolder', '三百', 'ñba', '七'];
const jobName = 'Sohn';

const pathToRepo = path.resolve('./target/test-project-folder');
const soureRep = './src/test/resources/multibranch_1';

function getProjectName(nameArray, seperator) {
if (!seperator) {
Expand All @@ -23,7 +25,8 @@ console.log('*** ', pathToRepo, 'jobName', jobName);
module.exports = {

before: function (browser, done) {
git.createRepo('./src/test/resources/multibranch_1', pathToRepo)

git.createRepo(soureRep, pathToRepo)
.then(function () {
git.createBranch('feature/1', pathToRepo)
.then(done);
Expand Down Expand Up @@ -95,18 +98,27 @@ module.exports = {
},

'Check whether the changes tab shows changes': function (browser) {
// create new files and a commit
fse.writeFile(path.join(pathToRepo, '666.txt'), '666');
git.createCommit(pathToRepo, ['666.txt']);
// now we have to index the branch
const masterJob = browser.page.jobUtils()
.forJob(getProjectName(anotherFolders), '/indexing');
// start a new build by starting indexing
masterJob.indexingStarted();
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 2);
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.validateNotEmptyChanges(browser, 1);
async.series([
function(callback) {
// create new files and a commit
fse.writeFile(path.join(pathToRepo, '666.txt'), '666');
git.createCommit(pathToRepo, ['666.txt']);
callback(null, null);
},
function(callback) {
// now we have to index the branch
const masterJob = browser.page.jobUtils()
.forJob(getProjectName(anotherFolders), '/indexing');
// start a new build by starting indexing
masterJob.indexingStarted();
// test whether we have commit
const blueRunDetailPage = browser.page.bluePipelineRunDetail().forRun(projectName, 'jenkins', 'master', 2);
blueRunDetailPage.clickTab(browser, 'changes');
blueRunDetailPage.validateNotEmptyChanges(browser, 1);
callback(null, null);
}
]);

},

// JENKINS-36615 the multibranch project has the branch 'feature/1'
Expand Down

0 comments on commit 12a0917

Please sign in to comment.