Skip to content

Commit

Permalink
random git shas
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbo committed Dec 22, 2023
1 parent d0a7c87 commit 1ec8b92
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/create-dev-data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-console */
const { addDays, addMinutes } = require('date-fns');
Promise.props = require('promise-props');
const crypto = require('crypto');
const BuildLogs = require('../api/services/build-logs');
const { encrypt } = require('../api/services/Encryptor');
const EventCreator = require('../api/services/EventCreator');
Expand Down Expand Up @@ -114,6 +115,10 @@ function socketIOError() {
};
}

function randomGitSha() {
return crypto.createHash('sha1').update(crypto.randomBytes(30)).digest('hex');
}

// Chainable helpers
async function createUAAIdentity(user) {
await user.createUAAIdentity({
Expand Down Expand Up @@ -380,6 +385,7 @@ async function createData() {
user: user1.id,
username: user1.username,
token: 'fake-token',
requestedCommitSha: randomGitSha(),
}),
Build.create({
branch: site1.defaultBranch,
Expand All @@ -388,9 +394,8 @@ async function createData() {
user: user1.id,
username: user1.username,
token: 'fake-token',
}).then(build => build.update({
requestedCommitSha: '57ce109dcc2cb8675ccbc2d023f40f82a2deabe1',
})),
requestedCommitSha: randomGitSha(),
}),
Build.create({
branch: site1.demoBranch,
source: 'fake-build',
Expand Down

0 comments on commit 1ec8b92

Please sign in to comment.