From d228e3bb99d2af629da588a2ee32cf015548af96 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Thu, 26 Dec 2024 03:50:20 -0500 Subject: [PATCH] Update SftpTransportIntegrationTests.kt --- .../transport/SftpTransportIntegrationTests.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/prime-router/src/testIntegration/kotlin/transport/SftpTransportIntegrationTests.kt b/prime-router/src/testIntegration/kotlin/transport/SftpTransportIntegrationTests.kt index 92cfbb6b48d..578f3997a6d 100644 --- a/prime-router/src/testIntegration/kotlin/transport/SftpTransportIntegrationTests.kt +++ b/prime-router/src/testIntegration/kotlin/transport/SftpTransportIntegrationTests.kt @@ -32,6 +32,7 @@ import io.mockk.spyk import io.mockk.unmockkAll import net.schmizz.sshj.SSHClient import net.schmizz.sshj.connection.ConnectionException +import net.schmizz.sshj.sftp.RemoteResourceFilter import net.schmizz.sshj.sftp.RemoteResourceInfo import net.schmizz.sshj.sftp.SFTPClient import net.schmizz.sshj.transport.verification.HostKeyVerifier @@ -456,10 +457,11 @@ class SftpTransportIntegrationTests : TransportIntegrationTests() { @Test fun `ls happy path`() { val f = Fixture() + val nullRemoteResourceFilter: RemoteResourceFilter? = null every { f.mockSSHClient.newSFTPClient() } returns f.mockSFTPClient // mock a successful ls on the remote SFTP server - every { f.mockSFTPClient.ls(f.lsPath, null) } returns f.remoteResourceInfos + every { f.mockSFTPClient.ls(f.lsPath, nullRemoteResourceFilter) } returns f.remoteResourceInfos every { f.mockSFTPClient.close() } just runs every { f.mockSSHClient.close() } just runs every { f.mockSSHClient.disconnect() } just runs @@ -473,10 +475,11 @@ class SftpTransportIntegrationTests : TransportIntegrationTests() { @Test fun `ls connection error`() { val f = Fixture() + val nullRemoteResourceFilter: RemoteResourceFilter? = null every { f.mockSSHClient.newSFTPClient() } returns f.mockSFTPClient // throw a connection exception on ls - every { f.mockSFTPClient.ls(f.lsPath, null) } throws ConnectionException("oops") + every { f.mockSFTPClient.ls(f.lsPath, nullRemoteResourceFilter) } throws ConnectionException("oops") every { f.mockSFTPClient.close() } just runs every { f.mockSSHClient.close() } just runs every { f.mockSSHClient.disconnect() } just runs @@ -490,10 +493,14 @@ class SftpTransportIntegrationTests : TransportIntegrationTests() { @Test fun `ls ignore timeout error`() { val f = Fixture() + val nullRemoteResourceFilter: RemoteResourceFilter? = null every { f.mockSSHClient.newSFTPClient() } returns f.mockSFTPClient // throw a ConnectionException on ls with TimeoutException as a cause - every { f.mockSFTPClient.ls(f.lsPath, null) } throws ConnectionException("oops", TimeoutException()) + every { f.mockSFTPClient.ls(f.lsPath, nullRemoteResourceFilter) } throws ConnectionException( + "oops", + TimeoutException() + ) every { f.mockSFTPClient.close() } just runs every { f.mockSSHClient.close() } just runs every { f.mockSSHClient.disconnect() } just runs