-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix --expires-on flag parsing #78
Conversation
var apiClient utl.APIer | ||
var out observ.OutputWriter | ||
var ApiClient utl.APIer | ||
var Out observ.OutputWriter |
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.
Needed to make these public, so I can mock them in tests
(our lease service relies on global variables)
@@ -31,7 +31,7 @@ func (s *LeasesService) CreateLease(principalID string, budgetAmount float64, bu | |||
|
|||
expiry, err := s.Util.ExpandEpochTime(expiresOn) | |||
|
|||
if err != nil && expiry > 0 { | |||
if err == nil && expiry > 0 { |
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.
👆 Here's the bug
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.
Sigh...
Nicely done.
) | ||
|
||
func TestLeasesCreate(t *testing.T) { | ||
cli := NewCLITest(t) |
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.
Put together a quick happy-path test for dce leases create
. Could/should be expanded in the future, to cover other use cases
@@ -24,7 +24,7 @@ func (s *AccountsService) AddAccount(accountID, adminRoleARN string) { | |||
}, | |||
} | |||
params.SetTimeout(5 * time.Second) | |||
_, err := apiClient.PostAccounts(params, nil) | |||
_, err := ApiClient.PostAccounts(params, nil) |
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.
Needed to make these public, so I can mock them in tests
(our lease service relies on global variables)
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.
LGTM; nice work.
@@ -31,7 +31,7 @@ func (s *LeasesService) CreateLease(principalID string, budgetAmount float64, bu | |||
|
|||
expiry, err := s.Util.ExpandEpochTime(expiresOn) | |||
|
|||
if err != nil && expiry > 0 { | |||
if err == nil && expiry > 0 { |
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.
Sigh...
Nicely done.
bf28aa8
to
2e0c4c4
Compare
2e0c4c4
to
db9ae00
Compare
Proposed changes
Fixes #77
Add basic integration test coverage around
dce leases create
Types of changes
Checklist
README.md
, inline comments, etc.)CHANGELOG.md
under a## next
release, with a short summary of my changesRelevant Links