Skip to content

Commit

Permalink
Replaces HelpfulSuggestions#forCacheNeedsClean with #forCacheMetadata…
Browse files Browse the repository at this point in the history
…Corrupted. (GoogleContainerTools#477)
  • Loading branch information
coollog authored Jun 29, 2018
1 parent 54ade97 commit b4b6531
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,8 @@ public void build(HelpfulSuggestions helpfulSuggestions) throws BuildStepsExecut
buildLogger.lifecycle(buildSteps.getSuccessMessage());

} catch (CacheMetadataCorruptedException cacheMetadataCorruptedException) {
// TODO: Have this be different for Maven and Gradle.
throw new BuildStepsExecutionException(
helpfulSuggestions.forCacheMetadataCorrupted(), cacheMetadataCorruptedException);
helpfulSuggestions.forCacheNeedsClean(), cacheMetadataCorruptedException);

} catch (ExecutionException executionException) {
BuildConfiguration buildConfiguration = buildSteps.getBuildConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public HelpfulSuggestions(
this.targetImageAuthConfiguration = targetImageAuthConfiguration;
}

public String forCacheMetadataCorrupted() {
return suggest("run '" + clearCacheCommand + "' to clear the cache");
}

public String forHttpHostConnect() {
return suggest("make sure your Internet is up and that the registry you are pushing to exists");
}
Expand All @@ -71,7 +67,7 @@ public String forUnknownHost() {
}

public String forCacheNeedsClean() {
return suggest("run `clean` to clear your build cache");
return suggest("run '" + clearCacheCommand + "' to clear your build cache");
}

public String forCacheDirectoryNotOwned(Path cacheDirectory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void testBuildImage_cacheMetadataCorruptedException()
Assert.fail("buildImage should have thrown an exception");

} catch (BuildStepsExecutionException ex) {
Assert.assertEquals(TEST_HELPFUL_SUGGESTIONS.forCacheMetadataCorrupted(), ex.getMessage());
Assert.assertEquals(TEST_HELPFUL_SUGGESTIONS.forCacheNeedsClean(), ex.getMessage());
Assert.assertEquals(mockCacheMetadataCorruptedException, ex.getCause());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,14 @@ public class HelpfulSuggestionsTest {

@Test
public void testSuggestions_smoke() {
Assert.assertEquals(
"messagePrefix, perhaps you should run 'clearCacheCommand' to clear the cache",
TEST_HELPFUL_SUGGESTIONS.forCacheMetadataCorrupted());
Assert.assertEquals(
"messagePrefix, perhaps you should make sure your Internet is up and that the registry you are pushing to exists",
TEST_HELPFUL_SUGGESTIONS.forHttpHostConnect());
Assert.assertEquals(
"messagePrefix, perhaps you should make sure that the registry you configured exists/is spelled properly",
TEST_HELPFUL_SUGGESTIONS.forUnknownHost());
Assert.assertEquals(
"messagePrefix, perhaps you should run `clean` to clear your build cache",
"messagePrefix, perhaps you should run 'clearCacheCommand' to clear your build cache",
TEST_HELPFUL_SUGGESTIONS.forCacheNeedsClean());
Assert.assertEquals(
"messagePrefix, perhaps you should check that 'cacheDirectory' is not used by another application or set the `useOnlyProjectCache` configuration",
Expand Down

0 comments on commit b4b6531

Please sign in to comment.