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

Refactor and test [github] token persistence #1863

Merged
merged 16 commits into from
Aug 12, 2018
Merged

Refactor and test [github] token persistence #1863

merged 16 commits into from
Aug 12, 2018

Conversation

paulmelnikow
Copy link
Member

@paulmelnikow paulmelnikow commented Aug 8, 2018

After #1861 is merged I will get this into working shape.

Ref #1848

@paulmelnikow paulmelnikow added the core Server, BaseService, GitHub auth, Shared helpers label Aug 8, 2018
@shields-ci
Copy link

shields-ci commented Aug 8, 2018

Warnings
⚠️

This PR modified the server but none of the service tests. That's okay so long as it's refactoring existing code.

Messages
📖

✨ Thanks for your contribution to Shields, @paulmelnikow!

Generated by 🚫 dangerJS

@paulmelnikow paulmelnikow mentioned this pull request Aug 8, 2018
8 tasks
clock = sinon.useFakeTimers(new Date(2017, 9, 15).getTime())
})
afterEach(function() {
clock.restore()
Copy link
Member Author

Choose a reason for hiding this comment

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

This was causing a timeout in the new tests.

this.save = undefined
}

async initialize() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This code is a bit difficult to understand, in part because it's working against the interface of json-autosave which wants to own the data structure.

Copy link
Member

Choose a reason for hiding this comment

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

Not trivial indeed, but I think I get the gist of it. 👍

@paulmelnikow paulmelnikow changed the title [WIP] Refactor and test [github] token persistence Refactor and test [github] token persistence Aug 9, 2018
@paulmelnikow
Copy link
Member Author

This is ready for review!

@paulmelnikow paulmelnikow requested a review from PyvesB August 9, 2018 15:24
Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

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

This looks sensible to me, good work! 👍

this.save = undefined
}

async initialize() {
Copy link
Member

Choose a reason for hiding this comment

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

Not trivial indeed, but I think I get the gist of it. 👍


let path, persistence
beforeEach(function() {
path = tmp.tmpNameSync()
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing tmp will automatically clean up on exit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, it's not totally clear from the docs. Since we're not writing anything sensitive and it's a fresh name every time, I don't feel it's important to clean up the files, though I could be persuaded.

https://www.npmjs.com/package/tmp#synchronous-filename-generation

Copy link
Member

@PyvesB PyvesB Aug 10, 2018

Choose a reason for hiding this comment

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

It does say the following in the options section: "keep: signals that the temporary file or directory should not be deleted on exit, default is false". I'm generally not a fan of tests leaving droppings behind them, but we're probably fine here according to the documentation!

@paulmelnikow
Copy link
Member Author

paulmelnikow commented Aug 10, 2018

Before I merge this I want to be ready to deploy it. There's something wrong with the admin endpoint; so I can't back up the tokens. I'm going to fix that first.

Added: Ref #1886

@paulmelnikow
Copy link
Member Author

Okay, #1886 deployed and tokens backed up. Going to merge and deploy this now!

@paulmelnikow paulmelnikow merged commit 9007658 into badges:master Aug 12, 2018
@shields-deployment
Copy link

This pull request was merged to master branch. Now this change is waiting for deployment.
Deploys usually happen every few weeks. After deployment changes are copied to gh-pages branch.

This badge displays deployment status:

@paulmelnikow paulmelnikow deleted the token-persistence branch August 12, 2018 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth, Shared helpers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants