Skip to content

Commit

Permalink
🐛 fix compilation issue with new commons compress version in kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandens committed Jan 6, 2024
1 parent e8a8d3e commit daeb0f8
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ryandens.javaagent

import org.apache.commons.compress.archivers.ArchiveInputStream
import org.apache.commons.compress.archivers.ArchiveStreamFactory
import org.apache.commons.compress.archivers.tar.TarArchiveEntry
import org.gradle.testkit.runner.BuildResult
Expand Down Expand Up @@ -45,15 +46,17 @@ class JavaagentJibExtensionFunctionalTest {

// verify the agent was added to entrypoint
assertTrue(File(functionalTestDir, JIB_IMAGE).exists())

FileInputStream(File(functionalTestDir, JIB_IMAGE)).use { fis ->
ArchiveStreamFactory().createArchiveInputStream("tar", fis).use { ais ->
var entry = ais.nextEntry as TarArchiveEntry?
ArchiveStreamFactory().createArchiveInputStream<ArchiveInputStream<TarArchiveEntry>>(ArchiveStreamFactory.TAR, fis).use {
ais ->
var entry = ais.nextEntry
while (entry != null) {
if ("config.json".equals(entry.name)) {
if ("config.json" == entry.name) {
val json = ais.readBytes().toString(Charsets.UTF_8)
assertTrue(json.contains("-javaagent:/opt/jib-agents/simple-agent.jar"))
}
entry = ais.nextEntry as TarArchiveEntry?
entry = ais.nextEntry
}
}
}
Expand All @@ -73,14 +76,15 @@ class JavaagentJibExtensionFunctionalTest {
// verify the agent was added to entrypoint
assertTrue(File(functionalTestDir, JIB_IMAGE).exists())
FileInputStream(File(functionalTestDir, JIB_IMAGE)).use { fis ->
ArchiveStreamFactory().createArchiveInputStream("tar", fis).use { ais ->
var entry = ais.nextEntry as TarArchiveEntry?
ArchiveStreamFactory().createArchiveInputStream<ArchiveInputStream<TarArchiveEntry>>(ArchiveStreamFactory.TAR, fis).use {
ais ->
var entry = ais.nextEntry
while (entry != null) {
if ("config.json".equals(entry.name)) {
if ("config.json" == entry.name) {
val json = ais.readBytes().toString(Charsets.UTF_8)
assertFalse(json.contains("-javaagent:/opt/jib-agents"))
}
entry = ais.nextEntry as TarArchiveEntry?
entry = ais.nextEntry
}
}
}
Expand Down

0 comments on commit daeb0f8

Please sign in to comment.