Skip to content

Commit

Permalink
fix(java17): stop accessing private fields, run tests using JRE17
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgogerly committed Sep 20, 2023
1 parent 23be630 commit a80d60d
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
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
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
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
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
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
Expand Up @@ -147,14 +147,14 @@ class WerckerBuildMonitor extends CommonPollingMonitor<PipelineDelta, PipelinePo

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 @@ -203,7 +203,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
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
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
Expand Up @@ -98,7 +98,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
Expand Up @@ -91,7 +91,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
Expand Up @@ -94,7 +94,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
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
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 a80d60d

Please sign in to comment.