Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

[#412] Basic regression tests with different Gradle versions #414

Merged
merged 12 commits into from Sep 16, 2017
Merged

Conversation

szpak
Copy link
Member

@szpak szpak commented Sep 14, 2017

Implementation of #412. Currently, the integration tests with TestKit in the project covers only very basic elements, however, it detected an issue with Gradle 2 compatibility after an upgrade to Gradle 3+ (#413). The mechanism will be possible to reuse in new tests.

By default only current Gradle version is used for regression testing. Travis is configured to test with a few more versions.

Some other minor changes related to integration tests have been made.

In fact, I wanted to upgrade ShipKit to Gradle 4 to follow the Gradle development, however, until #413 is resolved or it is decided to drop Gradle 2 support (probably it's good for the projects to migrate anyway) it is problematic.

Btw, related TestKit bug in Gradle 4.0+ - gradle/gradle#2732

Closes #412.

Copy link
Member

@mockitoguy mockitoguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I left some feedback but I want to merge it. Nice improvement!

@@ -1,10 +1,15 @@
package org.shipkit.gradle

import org.gradle.testkit.runner.BuildResult
import testutil.GradleSpecification

class ShipkitGradlePluginIntegTest extends GradleSpecification {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do those tests work cleanly from IDEA? It's super important that's easy to run them in IDEA.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep them in a separate sourceset otherwise:

screenshot from 2017-09-16 10-49-26

Anyway, by default, just the current version is tested from IDE. It can be tweaked in Idea test runner to have more version tested if anyone needs to do that

@@ -86,7 +85,9 @@ class ShipkitBintrayPluginTest extends PluginSpecification {
}

def "prints informative message before upload"() {
BintrayUploadTask u = project.tasks[ShipkitBintrayPlugin.BINTRAY_UPLOAD_TASK]
//BintrayUploadTask cannot be referenced directly due to runtime error related to changes between Gradle 2 and 3:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it mean that Shipkit does not work with Gradle 2.x? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a strange issue related to the fact that Bintray plugin is built with Gradle 2.4 and it fails in integration tests run with newer Gradle versions by TestKit (it can, as there were incompatible changes in Gradle). I wanted to reproduce it in a separate Gradle project with just the Bintray plugin applied (and newer Gradle version) to report the issue to them, but it worked fine in that configuration.

If you have some space time, you can try to trace the issue and help Bintray team solve it (nevertheless, it hasn't been reported before, therefore, it should be rare).

.buildAndFail()
} catch (Exception e) {
println " ---- build.gradle ---- \n" + buildFile.text + "\n ------------------------"
throw e
}
}

protected List<String> skippedTaskPathsGradleBugWorkaround(String output) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch and workaround. Thank you!


@CompileStatic
@Slf4j
trait GradleVersionsDeterminer {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty cool, thank you! It's nice to have basic coverage for different Gradle versions!

.travis.yml Outdated
matrix:
include:
- jdk: oraclejdk8
env: SHIPKIT_REGRESSION_TESTS=quick
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document the env variables, how they are supposed to be used by Shipkit engineers. Perhaps in the dev guide readme file / contributing file. What is tested when ran locally, what when ran by CI, how to debug when CI fails. We love knowledge :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -25,7 +25,7 @@ dependencies {
testCompile("org.spockframework:spock-core:1.1-groovy-2.4") {
exclude module: "groovy-all"
}

testCompile 'info.solidsoft.spock:spock-global-unroll:0.5.1'
Copy link
Member

@mockitoguy mockitoguy Sep 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like software components from solidsoft domain :) What goodness this dependency brings in? Perhaps short comment in build.gradle.

Copy link
Member Author

@szpak szpak Sep 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/szpak/spock-global-unroll :

[The] Spock extension automatically enabling parametrized tests unrolling in the whole project.

It is enough to put the spock-gradle-unroll JAR on a classpath. No additional configuration is required. All parametrized tests (features) will unrolled automatically as the @unroll annotation would be put on it.

I put a short comment in shipkit.gradle.

People should be able to upgrade from 3.0 to 3.5.1. In addition having
tests for 2.14.1 it's likely to compatible with 3.0 if it is with 3.5.1.
@szpak szpak merged commit 46452c9 into master Sep 16, 2017
@szpak szpak deleted the gradle41 branch September 16, 2017 09:19
@szpak szpak mentioned this pull request Oct 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basic regression tests with different Gradle versions
2 participants