Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(analyzer): Fix a locally failing test case #1969

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions workers/analyzer/src/test/kotlin/AnalyzerDownloaderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import io.kotest.matchers.should
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNot

import io.mockk.every
import io.mockk.mockkObject
import io.mockk.unmockkAll

import java.io.IOException

import org.eclipse.apoapsis.ortserver.model.SubmoduleFetchStrategy
Expand All @@ -44,6 +48,10 @@ import org.ossreviewtoolkit.plugins.api.PluginConfig
class AnalyzerDownloaderTest : WordSpec({
val downloader = AnalyzerDownloader()

afterEach {
unmockkAll()
}

"downloadRepository" should {
"not recursively clone a Git repository if recursiveCheckout is false" {
val repositoryUrl = "https://github.com/oss-review-toolkit/ort-test-data-git-submodules.git"
Expand Down Expand Up @@ -208,6 +216,9 @@ class AnalyzerDownloaderTest : WordSpec({
}

"throw an exception if the VCS type cannot be determined from the URL" {
mockkObject(VersionControlSystem)
every { VersionControlSystem.forUrl(any(), any()) } returns null

shouldThrow<IllegalArgumentException> {
downloader.downloadRepository("https://example.com", "revision")
}
Expand Down
Loading