Skip to content

Commit

Permalink
fix(java17): stop accessing private fields, run tests using JRE17 (#1173
Browse files Browse the repository at this point in the history
) (#1175)

(cherry picked from commit d1f6ed8)

Co-authored-by: Matt Gogerly <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mergify[bot] and mattgogerly authored Sep 20, 2023
1 parent 786143d commit 95c19bd
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
uses: docker/setup-buildx-action@v2
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'
- name: Prepare build variables
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
uses: docker/setup-buildx-action@v2
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'
- name: Prepare build variables
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
uses: docker/setup-buildx-action@v2
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: |
17
11
distribution: 'zulu'
cache: 'gradle'
- name: Assemble release info
Expand Down
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ subprojects {
useJUnitPlatform()
}

tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(11)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
}

tasks.withType(JavaExec) {
if (System.getProperty('DEBUG', 'false') == 'true') {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8188'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ArtifactParserTest extends Specification {
then:
artifacts.first().fileName == "some-package-1.2.3-4.noarch.rpm"
artifacts.last().fileName == "another-package-4.3.2.deb"
artifacts.size == 2
artifacts.size() == 2
}

def "make sure we only have one unique entry for each artifact"() {
Expand All @@ -59,7 +59,7 @@ class ArtifactParserTest extends Specification {

then:
artifacts.first().fileName == "some-package-1.2.3-4.noarch.rpm"
artifacts.size == 1
artifacts.size() == 1
}

def "get multiple artifactory deb from log using default regexes"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ class WerckerBuildMonitor extends CommonPollingMonitor<PipelineDelta, PipelinePo
try {
Long cursor = cache.getLastPollCycleTimestamp(master, pipeline)
//The last build/run
Long lastBuildStamp = lastStartedAt.startedAt.fastTime
Long lastBuildStamp = lastStartedAt.startedAt.getTime()
Date upperBound = lastStartedAt.startedAt
if (cursor == lastBuildStamp) {
log.debug("[${master}:${pipeline}] is up to date. skipping")
return
}
cache.updateBuildNumbers(master, pipeline, allRuns)
List<Run> allBuilds = allRuns.findAll { it?.startedAt?.fastTime > cursor }
List<Run> allBuilds = allRuns.findAll { it?.startedAt?.getTime() > cursor }
if (!cursor && !igorProperties.spinnaker.build.handleFirstBuilds) {
cache.setLastPollCycleTimestamp(master, pipeline, lastBuildStamp)
return
Expand Down Expand Up @@ -213,7 +213,7 @@ class WerckerBuildMonitor extends CommonPollingMonitor<PipelineDelta, PipelinePo
building: (run.finishedAt == null),
result: res,
number: cache.getBuildNumber(master, pipeline, run.id),
timestamp: run.startedAt.fastTime as String,
timestamp: run.startedAt.getTime() as String,
id: run.id,
url: run.url
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class InfoControllerSpec extends Specification {

then:
def actualAccounts = new JsonSlurper().parseText(response.contentAsString);
actualAccounts.size == 1
actualAccounts.size() == 1
actualAccounts[0].permissions == [:]

}
Expand All @@ -142,7 +142,7 @@ class InfoControllerSpec extends Specification {

then:
def actualAccounts = new JsonSlurper().parseText(response.contentAsString);
actualAccounts.size == 1
actualAccounts.size() == 1
actualAccounts[0].name == 'master2'

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ConcourseServiceSpec extends Specification {
List<Build> builds = service.getBuilds('myteam/mypipeline/myjob', 1421717251402)

then:
builds.size == 3
builds.size() == 3
builds[0].id == '49-id'
builds[1].id == '48.1-id'
builds[2].id == '47-id'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class CommitControllerSpec extends Specification {
List commitsResponse = controller.compareCommits(projectKey, repositorySlug, controllerParams)

then:
commitsResponse.size == 2
commitsResponse.size() == 2

with(commitsResponse[0]) {
displayId == "1234512"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CommitControllerSpec extends Specification {
List commitsResponse = controller.compareCommits(projectKey, repositorySlug, ['to': toCommit, 'from': fromCommit])

then:
commitsResponse.size == 2
commitsResponse.size() == 2

with(commitsResponse[0]) {
displayId == "12345123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CommitControllerSpec extends Specification {
List commitsResponse = controller.compareCommits(projectKey, repositorySlug, ['to': toCommit, 'from': fromCommit])

then:
commitsResponse.size == 2
commitsResponse.size() == 2

with(commitsResponse[0]) {
displayId == "12345123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CommitControllerSpec extends Specification {
List commitsResponse = controller.compareCommits(projectKey, repositorySlug, ['to': toCommit, 'from': fromCommit])

then:
commitsResponse.size == 2
commitsResponse.size() == 2
commitsResponse[0].displayId == "12345"
commitsResponse[0].id == "1234512345123451234512345"
commitsResponse[0].authorDisplayName == "Joe Coder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class WerckerServiceSpec extends Specification {
]

expect:
service.jobs.size == 3
service.jobs.size() == 3
service.jobs.contains('x/foo/myApp2/myPipeX')
}

Expand Down

0 comments on commit 95c19bd

Please sign in to comment.