-
Notifications
You must be signed in to change notification settings - Fork 46
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
Factory function defaults #260
Conversation
|
||
it 'should return an object with valid keys', -> | ||
mockResin = getSdk() | ||
m.chai.expect(mockResin).to.include.keys(validKeys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default values also be unit-tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code for them is so trivial it's not strictly required. If that means exposing the object (to make it reachable from the test code) I'd rather not make this change.
Ah I see, |
With the CLI you have the workplace (your fs) that's persisted between the CLI runs. |
Ah I see, so I've explicitly set the browser defaults and then fetch the settings from the settings.client if in a node environment. Sound reasonable? |
hmm browser tests are failing on Travis but are passing locally? |
@lekkas any idea why the test would fail on travis but not locally? You ever had that? |
Hey @craig-mulligan sorry for the delay I've been away. This looks like it's being caused by #252. If you can't reproduce the issue locally, and you're not seeing exactly the same failure between the two test runs, I think you can assume that it's really being caused by that intermittent issue. If you're not sure you can rerun the test job a few times, and it should get to a passing state fairly soon. It definitely looks like the same spurious failure to me though. We should definitely fix this, I'll try and get some time to take a look at it properly later this week. |
@pimterry ah, cheers, thanks for pointing that out. I ran it again. It worked on node 4 but no 6 so must be an intermittent issue. Give me a shout if there is anything I can do to help with the testing when you get to it. :) |
|
||
if opts.isBrowser | ||
settings = | ||
get: notImplemented | ||
getAll: notImplemented | ||
else | ||
settings = require('resin-settings-client') | ||
defaults opts, | ||
settings.getAll() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One reservation I have is that here we're lazy and hope that the settings client uses the exact same names for the properties that are used by the SDK. While this assumption sounds reasonable it's not ensured by any contract.
I'd also rather use the explicit whitelist instead of blindly passing everything stored in the settings (that are general-purposed and can be used by the user's code).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, so explicitly extract them eg:dataDirectory: settings.get('dataDirectory')
?
Yeah, like that and for all others that we need.
…On Tue, Jan 24, 2017 at 6:19 PM, Craig Mulligan ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/resin.coffee <#260>:
>
if opts.isBrowser
settings =
get: notImplemented
getAll: notImplemented
else
settings = require('resin-settings-client')
+ defaults opts,
+ settings.getAll()
Gotcha, so explicitly extract them eg:dataDirectory:
settings.get('dataDirectory') ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#260>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAgGCBZIBDvMiqrXWt4eUTSTPHrZe-bzks5rViR0gaJpZM4Lkt7f>
.
--
Eugene Mirotin
Senior Frontend Engineer
site: Resin.io <https://resin.io/>, twitter: @resin_io
<https://twitter.com/resin_io>
|
Great, fixed! |
apiVersion: 'v2', | ||
isBrowser: window? | ||
isBrowser: window?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded comma?
|
||
if opts.isBrowser | ||
settings = | ||
get: notImplemented | ||
getAll: notImplemented | ||
else | ||
settings = require('resin-settings-client') | ||
defaults opts, | ||
imageMakerUrl: settings.get('imageMakerUrl'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded comma too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fkn coffee script :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please squash before merging
Oh, and can we have the changelog entry please? |
Will do, we should add versionist, I'll create an issue. |
This makes all options truly optional eg. you can now - require('resin-sdk')(); Change-type: Patch
88e244d
to
16eecb6
Compare
connects to #258 and some of #251.
Defaults are as follows:
Not sure about
dataDirectory
as it requires root privileges?