-
Notifications
You must be signed in to change notification settings - Fork 59
#218 Do not lookup for existing cache with given skip cache and cache enabled parameters #413
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,103 @@ | ||||||
| /* | ||||||
| * Licensed to the Apache Software Foundation (ASF) under one | ||||||
| * or more contributor license agreements. See the NOTICE file | ||||||
| * distributed with this work for additional information | ||||||
| * regarding copyright ownership. The ASF licenses this file | ||||||
| * to you under the Apache License, Version 2.0 (the | ||||||
| * "License"); you may not use this file except in compliance | ||||||
| * with the License. You may obtain a copy of the License at | ||||||
| * | ||||||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| * | ||||||
| * Unless required by applicable law or agreed to in writing, | ||||||
| * software distributed under the License is distributed on an | ||||||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| * KIND, either express or implied. See the License for the | ||||||
| * specific language governing permissions and limitations | ||||||
| * under the License. | ||||||
| */ | ||||||
| package org.apache.maven.buildcache.its; | ||||||
|
|
||||||
| import java.util.List; | ||||||
|
|
||||||
| import org.apache.maven.buildcache.its.junit.IntegrationTest; | ||||||
| import org.apache.maven.it.VerificationException; | ||||||
| import org.apache.maven.it.Verifier; | ||||||
| import org.junit.jupiter.api.Test; | ||||||
|
|
||||||
| @IntegrationTest("src/test/projects/skip-cache-param") | ||||||
| public class SkipCacheParamTest { | ||||||
|
|
||||||
| @Test | ||||||
| void skipCacheAndCacheDisabled(Verifier verifier) throws VerificationException { | ||||||
| // cache.enabled=false , cache.skipCache=false => cache should NOT be created | ||||||
| verifier.setAutoclean(false); | ||||||
| verifier.setLogFileName("../log-0.txt"); | ||||||
| verifier.addCliOption("-Dmaven.build.cache.enabled=false"); | ||||||
| verifier.addCliOption("-Dmaven.build.cache.skipCache=false"); | ||||||
|
|
||||||
| verifier.executeGoal("package"); | ||||||
|
|
||||||
| verifier.verifyErrorFreeLog(); | ||||||
| verifier.verifyTextInLog("Building jar:"); | ||||||
| verifyTextNotInLog(verifier, "Saved Build to local file:"); | ||||||
| } | ||||||
|
|
||||||
| @Test | ||||||
| void cacheEnabledShouldCreateCache(Verifier verifier) throws VerificationException { | ||||||
| // cache.enabled=true , cache.skipCache=false => cache should be created, normal scenario | ||||||
| verifier.setAutoclean(false); | ||||||
| verifier.setLogFileName("../log-1.txt"); | ||||||
| verifier.addCliOption("-Dmaven.build.cache.enabled=true"); | ||||||
| verifier.addCliOption("-Dmaven.build.cache.skipCache=false"); | ||||||
|
|
||||||
| verifier.executeGoal("package"); | ||||||
|
|
||||||
| verifier.verifyErrorFreeLog(); | ||||||
| verifier.verifyTextInLog("Going to calculate checksum for project"); | ||||||
| } | ||||||
|
|
||||||
| @Test | ||||||
| void disabledCacheAndSkipCacheShouldNotCreateCache(Verifier verifier) throws VerificationException { | ||||||
| // cache.enabled=false , cache.skipCache=true => cache should NOT be created | ||||||
| verifier.setAutoclean(false); | ||||||
|
|
||||||
| verifier.setLogFileName("../log-2.txt"); | ||||||
| verifier.addCliOption("-Dmaven.build.cache.enabled=false"); | ||||||
| verifier.addCliOption("-Dmaven.build.cache.skipCache=true"); | ||||||
|
|
||||||
| verifier.executeGoal("package"); | ||||||
|
|
||||||
| verifier.verifyErrorFreeLog(); | ||||||
| verifier.verifyTextInLog("Building jar:"); | ||||||
| verifyTextNotInLog(verifier, "Saved Build to local file:"); | ||||||
| } | ||||||
|
|
||||||
| @Test | ||||||
| void enabledCacheAndSkippingCacheShouldNotCreateCache(Verifier verifier) throws VerificationException { | ||||||
| // cache.enabled=true , cache.skipCache= true => cache should not be read, only be created | ||||||
|
||||||
| // cache.enabled=true , cache.skipCache= true => cache should not be read, only be created | |
| // cache.enabled=true , cache.skipCache=true => cache should not be read, only be created |
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 important is this? I would ignore such suggestion this as well
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
|
|
||
| --> | ||
| <extensions> | ||
| <extension> | ||
| <groupId>org.apache.maven.extensions</groupId> | ||
| <artifactId>maven-build-cache-extension</artifactId> | ||
| <version>${projectVersion}</version> | ||
| </extension> | ||
| </extensions> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
|
|
||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <groupId>com.mayweg</groupId> | ||
| <artifactId>untitled</artifactId> | ||
| <version>1.0-SNAPSHOT</version> | ||
| <properties> | ||
| </properties> | ||
| </project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| public class Main { | ||
| public static void main(String[] args) { | ||
| System.out.println("Hello World!"); | ||
| } | ||
| } |
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.
The test method name and comment contradict each other. The method is named
enabledCacheAndSkippingCacheShouldNotCreateCachebut the comment on line 78 states "cache should not be read, only be created" and the test verifies on line 87 that the cache is saved. The method name should reflect that cache IS created but not read/restored.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.
I honestly find existing test name quite good since it does address the current issue: cache is being created when it's not the desired result