-
Notifications
You must be signed in to change notification settings - Fork 629
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: Azure Fusion env misses credentials when no key or SAS provided #5287
Changes from 2 commits
92c974c
89710df
a6006f0
0171fa3
8b92f8f
f11d62d
dd20318
a832bde
61374f8
5b67abe
3139dae
cab3ffe
d05cae5
577bfb4
f93e25b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,27 @@ class AzFusionEnvTest extends Specification { | |
|
||
} | ||
|
||
def 'should return env environment with SAS token config when accountKey is provided'() { | ||
given: | ||
Global.session = Mock(Session) { | ||
getConfig() >> [azure: [storage: [accountName: 'myaccount', accountKey: 'myaccountkey']]] | ||
} | ||
def mockStorageObject = Mock(Object) { | ||
getOrCreateSasToken() >> 'generatedSasToken' | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pditommaso o great Spock wizard, why does it not mock the getOrCreateSasToken method properly here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried that and I get the same result, |
||
def config = Mock(FusionConfig) { | ||
storage() >> mockStorageObject | ||
} | ||
|
||
when: | ||
def env = new AzFusionEnv().getEnvironment('az', config) | ||
|
||
then: | ||
env.AZURE_STORAGE_ACCOUNT == 'myaccount' | ||
env.AZURE_STORAGE_SAS_TOKEN | ||
env.size() == 2 | ||
} | ||
|
||
def 'should return env environment with SAS token config'() { | ||
given: | ||
Global.session = Mock(Session) { | ||
|
@@ -99,4 +120,5 @@ class AzFusionEnvTest extends Specification { | |
then: | ||
thrown(IllegalArgumentException) | ||
} | ||
|
||
} |
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.
@adamrtalbot Could we please update this comment to something like:
so that this doesn't happen again?
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.
How about this:
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.
That's not much different from what the code itself already tells. I would prefer to have a explicit comment telling us why it's needed despite the configuration not requesting it explicitly.