config: Fail if ClientID not provided#197
Conversation
|
@djmitche I was using I hope this approach is fine since it looks similar to the one we use while loading configuration. But I am not sure why the tests failed. I tried rebuilding it a few times but the logs didn't change. My previous approach of using |
|
I had another question, I don't see any test files in the codebase so how is taskcluster running tests on my PR? |
|
Taskcluster runs based on .taskcluster.yml. As for the failure, it looks like this is it: so there's a test somewhere (TestCommandGeneration) that was getting away with setting only one of those options, and that's not allowed anymore. Or, it's setting none of the options. Note that it's OK to run tc-cli without any credentials. The case we want to fix is when exactly one of the clientId and accessToken are supplied. |
|
@djmitche I looked at Please review |
djmitche
left a comment
There was a problem hiding this comment.
This change modifies Setup to return an error, but the code that calls Setup isn't modified -- so that error is ignored.
Instead of returning an error, there's an example of error-handling in this function already, when Load returns an error. I'd suggest copying that approach instead of returning an error. The alternative is to make both failure conditions return error and then handle it in main.go.
| "revisionTime": "2017-03-30T08:48:43Z" | ||
| }, | ||
| { | ||
| "checksumSHA1": "DCjamhJdcLN963jm6/yFoDbJvT4=", |
There was a problem hiding this comment.
The checksums shouldn't have changed here. This is likely due to a bug in govendor or something like that, rather than your fault. But please revert changes to this file.
There was a problem hiding this comment.
Sorry about that I actually ran the tests locally which made govender sync run and then I must have committed it while amending my changes.
One question since running tests changes vendor.json should we run the tests locally or add vendor.json to .gitignore
| } | ||
| } else { | ||
| return errors.New("Either ClientID or Access Token not set") | ||
| } |
There was a problem hiding this comment.
If we draw out the expected logic chart here:
| ok1 | !ok1 | |
|---|---|---|
| ok2 | set up credentials | error |
| !ok2 | error | leave credentials nil |
It's OK for both the clientId and accessToken to be missing (!ok1 && !ok2). But as you've written it, that condition would be regarded as an error.
|
I'll make the changes by tonight. |
|
Good question re govendor -- and one beyond my Go abilities. @petemoore can you help? |
|
Note that running |
Well I didn't have a lot of packages installed locally before running |
|
Another question: Do we have some kind of coverage testing for this repo? |
|
I don't think coverage testing is set up. In my experience, that sort of automation for Go projects requires a lot of manual intervention. For example, we run |
|
@djmitche please review |
djmitche
left a comment
There was a problem hiding this comment.
Haha, it ended up being very short!
Thanks!
|
Are there other tc-cli bugs you'd like to work on? Or something else? |
|
@djmitche thanks for the merge I would love to work more I will be looking for some other beginner issues in this repo and the others. If you happen to raise a new beginner issue feel free to cc me |
Fixes #191