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

feat(build): add build number #109

Merged
merged 4 commits into from
Feb 26, 2017
Merged

feat(build): add build number #109

merged 4 commits into from
Feb 26, 2017

Conversation

gregberge
Copy link
Member

@gregberge gregberge commented Feb 22, 2017

Closes #106

@gregberge gregberge force-pushed the wip-builds-number branch 2 times, most recently from 78911c8 to a66a817 Compare February 22, 2017 22:25
@gregberge gregberge changed the title WIP build number feat(build): add build number Feb 22, 2017
await knex.raw(`
UPDATE builds SET number = numbers.number
FROM (
SELECT id, row_number() OVER (PARTITION BY "repositoryId" ORDER BY id) AS number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's working 👍
capture d ecran 2017-02-23 a 09 29 11

Copy link
Contributor

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a test for the number would be good.

@@ -58,6 +59,16 @@ export default class Build extends BaseModel {
}
}

$toDatabaseJson() {
const attributes = super.$toDatabaseJson()
attributes.number = this.$knex().raw(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work if we do a patch on the build?

@gregberge gregberge force-pushed the wip-builds-number branch 3 times, most recently from c811966 to 0726b0d Compare February 26, 2017 10:27
knex = connect('test')
await knex.migrate.latest()
await truncateAll(knex)
beforeAll(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's going to be much better 👍 .

Runs a function before any of the tests in this file run

I'm wondering if we could make it global.

@@ -13,6 +13,24 @@ const baseData = {
describe('models/Build', () => {
useDatabase()

describe('create build', () => {
it('should add a build number', async () => {
const build = await factory.create('Build')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build1?

expect(build.number).toBe(1)
await build.$query().patch({ jobStatus: 'complete' })
expect(build.jobStatus).toBe('complete')
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect(build.number).toBe(1)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reload might be good too.

// Process on exit and signals.
process.on('exit', () => {
terminator()
log('Node server stopped.')
});

// Removed 'SIGPIPE' from the list - bugz 852598.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the issue was fixed nodejs/node-v0.x-archive#2286.

log('Shutdown server gracefully...')
log(`${SHUTDOWN_TIMEOUT}ms before killing it.`)
callbacks.forEach(callback => callback())
setTimeout(() => terminator(), SHUTDOWN_TIMEOUT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an ideal world, we would clear this timeout once the callbacks complete.
Right now, I'm expecting the program to always wait 3s before closing, with no feedback regarding if it was clean or not.

@gregberge gregberge force-pushed the wip-builds-number branch 2 times, most recently from 31ac82c to 2fd7bf6 Compare February 26, 2017 16:18
@gregberge gregberge merged commit b496de7 into master Feb 26, 2017
@gregberge gregberge deleted the wip-builds-number branch February 26, 2017 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants