-
Notifications
You must be signed in to change notification settings - Fork 49
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
chore: fix unit tests using gcloud ADC #3722
Merged
Merged
Changes from all commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
9991811
feat: initial removal of Credential argument in newApi() methods
diegomarquezp bafad26
chore: move account resolution to new class
diegomarquezp 8418100
chore: cleanup of deploy classes
diegomarquezp fa88457
chore: cleanup of deploy UI classes
diegomarquezp e95eb0c
chore: cleanup of cloudsdk staging helper
diegomarquezp 9ad0f16
chore: correct precond check, correct exception logging
diegomarquezp 63adb79
feat: modify "Manage Google Accounts" button to rely on gcloud ADC
diegomarquezp 25e14f8
fix: use `setBaseEnabled()` to correctly propagate login state
diegomarquezp 675d3f7
chore: better UI, on-demand cred check
diegomarquezp f8e5cb2
chore: [wip] adapt single account to deploy dialog
diegomarquezp 552c729
chore: display gcloud instruction messages
diegomarquezp 57b86d8
fix: layout to wrap no ADC message
diegomarquezp 7fedcf3
chore: disable deploy button when not logged in
diegomarquezp f874744
chore: do not throw exception when checking for credentials
diegomarquezp 9fca091
fix: compilation errors
diegomarquezp 29d0eee
fix: compilation errors in tests
diegomarquezp 6e44d2e
Merge branch 'gcloud-cli-creds-cleanup' into gcloud-cli-creds-test-fixes
diegomarquezp 0b62841
Merge branch 'gcloud-cli-creds-appengine-deploy' into gcloud-cli-cred…
diegomarquezp 3151477
Merge branch 'gcloud-cli-creds-deploy-no-project' into gcloud-cli-cre…
diegomarquezp 1373222
chore: initial compilation-enabling adjustments
diegomarquezp 1f74161
chore: use `hasCredentialsSet()`
diegomarquezp 8811a92
chore: add test account provider
diegomarquezp 57caab7
chore: fix usagetracker and projectselector test
diegomarquezp fe2bdee
chore: expose `getCredential()`
diegomarquezp d251d6f
chore: fix projectselector tests
diegomarquezp a9c9715
chore: null check for `setPRoviderState()`
diegomarquezp a601d7d
chore: add avatar URL to test accounts
diegomarquezp 4208f28
chore: fix login tests
diegomarquezp 49eae09
chore: fix googleapis tests
diegomarquezp 5c89517
chore: add convenience state+defaultprovider method
diegomarquezp 79a6be8
chore: fix dataflow tests
diegomarquezp 6e0fc57
chore: fix dataflow core tests
diegomarquezp 5b4c232
chore: fix error-prone state check in localserver
diegomarquezp a6b950f
chore: correct static member initialization order in `TestAccountProv…
diegomarquezp 68f1579
chore: initialize static account provider once
diegomarquezp 7387366
chore: use mock methods instead of test acct provider in `MiniSelecto…
diegomarquezp 275dd40
Merge branch 'gcloud-cli-creds' into gcloud-cli-creds-test-fixes
diegomarquezp fb425e8
chore: fixes after merging `gcloud-cli-creds`
diegomarquezp bcd858d
chore: use avatar urls in test accounts
diegomarquezp e64af26
chore: fix accounts panel tests
diegomarquezp f24ce4b
chore: fix dataflow preferences test
diegomarquezp 35404ae
chore: fix login `Account` package
diegomarquezp 17182c2
chore: fix usagetracker test ii
diegomarquezp d72792e
fix: project repository test
diegomarquezp 9d59678
chore: fix googleapis proxy tests
diegomarquezp c9ddc7d
fix: dataflow preferences test
diegomarquezp 20dfaec
chore: fix login tests, remove unused elements (pending cleanup)
diegomarquezp 92bd48e
chore: fix app engine deploy tests
diegomarquezp 2baf89b
chore: remove unnecessary test in `GcpProjectQueryJobTest`
diegomarquezp 1f3fdba
chore: fix localserver tests iii
diegomarquezp 2f922c5
chore: more dataflow ui test fixes
diegomarquezp 0858bcc
chore: fix project repository test
diegomarquezp df2f533
chore: accounts panel test to assert correct number of children
diegomarquezp 855db03
chore: run tests on any pr
diegomarquezp d227577
chore: fix update accounts logic in `GoogleLoginService`
diegomarquezp bba6286
chore: remove initialization of static members in constructors
diegomarquezp f71b56b
chore: fire listeners in `AccountSelector`
diegomarquezp d68707e
chore: fix `GoogleApiFactory` initalization in `GcpLocalRunTabTest`
diegomarquezp 59b97d0
chore: fix cache check in `AccountSelector`
diegomarquezp 5ff7a3f
chore: fix `CloudSdkProcessWrapperTest`
diegomarquezp ffb6aa2
chore: correct stubbing in `DefaultedPipelineOptionsComponentTest`
diegomarquezp b7e54f4
chore: remove unused imports in `CloudSdkProcessWrapper`
diegomarquezp f40809e
chore: remove unused import in `AccountPanelsTest`
diegomarquezp fd1d42e
chore: trigger update on `GcpLocalRunTabTest`
diegomarquezp 9c68243
chore: fix `fireSelectionListeners` after setting change tracker vari…
diegomarquezp a18bf6d
chore: fix `GcpLocalRUnTabTest`
diegomarquezp b1426ac
chore: refactor force `AccountSelector` check to a better named method
diegomarquezp 41de20a
chore: return validation states in `RunOptionsDefaultsComponent`
diegomarquezp bdac2ed
chore: add status checks to other test in `RODCTest`
diegomarquezp 9dcdcc5
chore: make `forceCheck()` public in `AccountSelector`
diegomarquezp a53f488
chore: remove unused thrown exception from delcaration in `GcpLocalRu…
diegomarquezp 99b0e97
chore: set flag to enable `forceAccountCheck`
diegomarquezp 1a2580d
chore: have dataflow Command RunOptionsDefaultScomponent not found to…
diegomarquezp 2db054f
chore: fix login service test
diegomarquezp 9c4978d
chore: fix assertions, verify projects loaded in `RunOptionsDefaultCO…
diegomarquezp 3c78d87
chore: update project lists on account change in `RunOptionsDefaultsC…
diegomarquezp 4364ac4
chore: lock `login` `com.google.api` versions to `1.25.0`
diegomarquezp 9b34c42
chore: remove unthrown exception declaration in `GcpLocalRunTabTest`
diegomarquezp 055cbf9
chore: fix tests in `RunOptionsDefaultsCOmponentTest`
diegomarquezp 89617b3
chore: correct versions in login MANIFEST.MF
diegomarquezp dfc3e42
chore: fix Command setUpServiceKeyCreation not found in Command GcpLo…
diegomarquezp d4ed22d
chore: make account selector to return update result
diegomarquezp a224d05
chore: fix non-existent version of `com.google.api.services.oauth2`
diegomarquezp 70eba60
chore: fix logic check in `forceAccountCHeck` for `AccountSelector`
diegomarquezp 8606143
chore: exclude `oauth2` package in manifest check
diegomarquezp a644598
chore: fix comments in default pipeline options test
diegomarquezp f1786ba
chore: fixes in dataflow tests
diegomarquezp 861577d
chore: remove TODO comment
diegomarquezp 456716b
chore: using `EnumMap` in `TestAccountProvider`
diegomarquezp 6986f65
chore: handle `GoogleApiFactory` credential-related methods internall…
diegomarquezp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,18 +17,17 @@ | |
package com.google.cloud.tools.eclipse.appengine.deploy.util; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
import com.google.cloud.tools.appengine.operations.AppEngineWebXmlProjectStaging; | ||
import com.google.cloud.tools.appengine.operations.Deployment; | ||
import com.google.cloud.tools.appengine.operations.cloudsdk.CloudSdkNotFoundException; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import com.google.cloud.tools.eclipse.test.util.TestAccountProvider; | ||
import com.google.cloud.tools.eclipse.test.util.TestAccountProvider.State; | ||
import org.eclipse.core.runtime.Status; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
@@ -39,34 +38,25 @@ public class CloudSdkProcessWrapperTest { | |
|
||
private final CloudSdkProcessWrapper wrapper = new CloudSdkProcessWrapper(); | ||
|
||
@Before | ||
public void setUp() { | ||
TestAccountProvider.setAsDefaultProvider(State.NOT_LOGGED_IN); | ||
} | ||
|
||
@Test | ||
public void testGetAppEngineDeployment_nullCredentialFile() throws CloudSdkNotFoundException { | ||
try { | ||
wrapper.getAppEngineDeployment(null, null); | ||
wrapper.getAppEngineDeployment(null); | ||
fail(); | ||
} catch (NullPointerException ex) { | ||
} catch (IllegalStateException ex) { | ||
assertEquals(ex.getMessage(), "credential required for deploying"); | ||
} | ||
} | ||
|
||
@Test | ||
public void testGetAppEngineDeployment_nonExistingCredentialFile() | ||
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. Providing credentials does not apply anymore. |
||
throws CloudSdkNotFoundException { | ||
Path credential = tempFolder.getRoot().toPath().resolve("non-existing-file"); | ||
assertFalse(Files.exists(credential)); | ||
|
||
try { | ||
wrapper.getAppEngineDeployment(credential, null); | ||
fail(); | ||
} catch (IllegalArgumentException ex) { | ||
assertEquals(ex.getMessage(), "non-existing credential file"); | ||
} | ||
} | ||
|
||
@Test | ||
public void testGetAppEngineDeployment() throws IOException, CloudSdkNotFoundException { | ||
Path credential = tempFolder.newFile().toPath(); | ||
Deployment deployment = wrapper.getAppEngineDeployment(credential, null); | ||
public void testGetAppEngineDeployment() throws CloudSdkNotFoundException { | ||
TestAccountProvider.setProviderState(State.LOGGED_IN); | ||
Deployment deployment = wrapper.getAppEngineDeployment(null); | ||
assertNotNull(deployment); | ||
} | ||
|
||
|
@@ -78,11 +68,11 @@ public void testGetAppEngineStandardStaging() throws CloudSdkNotFoundException { | |
|
||
@Test | ||
public void testGetAppEngineDeployment_cannotSetUpTwice() | ||
throws IOException, CloudSdkNotFoundException { | ||
Path credential = tempFolder.newFile().toPath(); | ||
wrapper.getAppEngineDeployment(credential, null); | ||
throws CloudSdkNotFoundException { | ||
TestAccountProvider.setProviderState(State.LOGGED_IN); | ||
wrapper.getAppEngineDeployment(null); | ||
try { | ||
wrapper.getAppEngineDeployment(credential, null); | ||
wrapper.getAppEngineDeployment(null); | ||
fail(); | ||
} catch (IllegalStateException ex) { | ||
assertEquals(ex.getMessage(), "process wrapper already set up"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As long as a test suite does not instantiate a client (e.g.
apiFactory.newXXXClient()
), this account provider must be setup to prevent actual calls or credential checks