Skip to content

Commit

Permalink
Change parameters in the ft tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ozonophore committed May 27, 2024
1 parent 16cdaa1 commit 5147d81
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ abstract class BaseVcsFacadeFunctionalTest(testClient: TestClient, sshUrlFormat:

companion object {
private val client = ClassicVcsFacadeClient(object : VcsFacadeClientParametersProvider {
override fun getApiUrl() = "http://localhost:8080"
override fun getApiUrl() = Configuration.model.vcsFacadeUrl
override fun getTimeRetryInMillis() = 180000
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,31 @@ package org.octopusden.octopus.vcsfacade
import org.junit.jupiter.api.condition.EnabledIfSystemProperty
import org.octopusden.octopus.infastructure.bitbucket.test.BitbucketTestClient

private const val VCS_HOST = "bitbucket:7990"

@EnabledIfSystemProperty(named = "test.profile", matches = "bitbucket")
@EnabledIfSystemProperty(named = TEST_PROFILE, matches = BITBUCKET)
class VcsFacadeFunctionalTestBitbucket : BaseVcsFacadeFunctionalTest(
BitbucketTestClient("http://localhost:7990", BITBUCKET_USER, BITBUCKET_PASSWORD, VCS_HOST),
"ssh://git@$VCS_HOST/%s/%s.git"
BitbucketTestClient(
Configuration.model.bitbucket.url,
Configuration.model.bitbucket.user,
Configuration.model.bitbucket.password,
Configuration.model.bitbucket.host,
),
"ssh://git@${Configuration.model.bitbucket.host}/%s/%s.git"
) {
override val exceptionsMessageInfo: Map<String, String> by lazy {
val project = Configuration.model.project
val defaultId = Configuration.model.defaultId
val repository = Configuration.model.repository
val message1 = Configuration.model.message1
val message3 = Configuration.model.message3
mapOf(
"absent-repo" to "Repository $PROJECT/absent does not exist.",
"commitById" to "Commit '$DEFAULT_ID' does not exist in repository '$REPOSITORY'.",
"commitsException_1" to "Commit '$DEFAULT_ID' does not exist in repository '$REPOSITORY'.",
"absent-repo" to "Repository $project/absent does not exist.",
"commitById" to "Commit '$defaultId' does not exist in repository '$repository'.",
"commitsException_1" to "Commit '$defaultId' does not exist in repository '$repository'.",
"commitsException_2" to "Params 'fromHashOrRef' and 'fromDate' can not be used together",
"commitsException_3" to "Cannot find commit '${MESSAGE_3.commitId(REPOSITORY)}' in commit graph for commit '${MESSAGE_1.commitId(REPOSITORY)}' in '$PROJECT:$REPOSITORY'",
"commitsException_3" to "Cannot find commit '${message3.commitId(repository)}' in commit graph for commit '${message1.commitId(repository)}' in '$project:$repository'",
"pr_1" to "Project absent does not exist.",
"pr_2" to "Source branch 'absent' not found in '$PROJECT:$REPOSITORY'",
"pr_3" to "Target branch 'absent' not found in '$PROJECT:$REPOSITORY'"
"pr_2" to "Source branch 'absent' not found in '$project:$repository'",
"pr_3" to "Target branch 'absent' not found in '$project:$repository'"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,40 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty
import org.junit.jupiter.params.provider.Arguments
import org.octopusden.octopus.infrastructure.gitea.test.GiteaTestClient

private const val VCS_HOST = "gitea:3000"

@EnabledIfSystemProperty(named = "test.profile", matches = "gitea")
@EnabledIfSystemProperty(named = TEST_PROFILE, matches = GITEA)
class VcsFacadeFunctionalTestGitea : BaseVcsFacadeFunctionalTest(
GiteaTestClient("http://localhost:3000", GITEA_USER, GITEA_PASSWORD, VCS_HOST),
"ssh://git@$VCS_HOST:%s/%s.git"
GiteaTestClient(
Configuration.model.gitea.url,
Configuration.model.gitea.user,
Configuration.model.gitea.password,
Configuration.model.gitea.host
),
"ssh://git@${Configuration.model.gitea.host}:%s/%s.git"
) {
//TODO: test using opensearch
override fun issueCommits(): Stream<Arguments> = Stream.of(
Arguments.of("ABSENT-1", emptyList<String>()),
)

override val exceptionsMessageInfo: Map<String, String> by lazy {
val project = Configuration.model.project
val defaultId = Configuration.model.defaultId
val repository = Configuration.model.repository
val message1 = Configuration.model.message1
val message3 = Configuration.model.message3
mapOf(
"absent-repo" to "The target couldn't be found.",
"commitById" to DEFAULT_ID,
"commitsException_1" to "object does not exist [id: $DEFAULT_ID, rel_path: ]",
"commitById" to defaultId,
"commitsException_1" to "object does not exist [id: $defaultId, rel_path: ]",
"commitsException_2" to "Params 'fromHashOrRef' and 'fromDate' can not be used together",
"commitsException_3" to "Cannot find commit '${MESSAGE_3.commitId(REPOSITORY)}' in commit graph for commit '${
MESSAGE_1.commitId(
REPOSITORY
"commitsException_3" to "Cannot find commit '${message3.commitId(repository)}' in commit graph for commit '${
message1.commitId(
repository
)
}' in '$PROJECT:$REPOSITORY'",
}' in '$project:$repository'",
"pr_1" to "GetUserByName",
"pr_2" to "Source branch 'absent' not found in '$PROJECT:$REPOSITORY'",
"pr_3" to "Target branch 'absent' not found in '$PROJECT:$REPOSITORY'"
"pr_2" to "Source branch 'absent' not found in '$project:$repository'",
"pr_3" to "Target branch 'absent' not found in '$project:$repository'"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,34 @@ import org.junit.jupiter.api.condition.EnabledIfSystemProperty
import org.junit.jupiter.params.provider.Arguments
import org.octopusden.octopus.infrastructure.gitlab.test.GitlabTestClient

private const val VCS_HOST = "gitlab:8990"

@EnabledIfSystemProperty(named = "test.profile", matches = "gitlab")
@EnabledIfSystemProperty(named = TEST_PROFILE, matches = GITLAB)
class VcsFacadeFunctionalTestGitlab : BaseVcsFacadeFunctionalTest(
GitlabTestClient("http://localhost:8990", GITLAB_USER, GITLAB_PASSWORD, VCS_HOST),
"ssh://git@$VCS_HOST:%s/%s.git"
GitlabTestClient(
Configuration.model.gitlab.url,
Configuration.model.gitlab.user,
Configuration.model.gitlab.password,
Configuration.model.gitlab.host
),
"ssh://git@${Configuration.model.gitlab.host}:%s/%s.git"
) {
override fun issueCommits(): Stream<Arguments> = Stream.of(
Arguments.of("ABSENT-1", emptyList<String>()),
)

override val exceptionsMessageInfo: Map<String, String> by lazy {
val project = Configuration.model.project
val defaultId = Configuration.model.defaultId
val repository = Configuration.model.repository
val message3 = Configuration.model.message3
mapOf(
"absent-repo" to "Repository '$PROJECT:absent' does not exist.",
"commitById" to "Commit '$DEFAULT_ID' does not exist in repository '$PROJECT:$REPOSITORY'.",
"commitsException_1" to "Commit '$DEFAULT_ID' does not exist in repository '$PROJECT:$REPOSITORY'.",
"absent-repo" to "Repository '$project:absent' does not exist.",
"commitById" to "Commit '$defaultId' does not exist in repository '$project:$repository'.",
"commitsException_1" to "Commit '$defaultId' does not exist in repository '$project:$repository'.",
"commitsException_2" to "Params 'fromHashOrRef' and 'fromDate' can not be used together",
"commitsException_3" to "Can't find commit '${MESSAGE_3.commitId(REPOSITORY)}' in graph but it exists in the '$PROJECT:$REPOSITORY'",
"commitsException_3" to "Can't find commit '${message3.commitId(repository)}' in graph but it exists in the '$project:$repository'",
"pr_1" to "Group 'absent' does not exist.",
"pr_2" to "Source branch 'absent' not found in '$PROJECT:$REPOSITORY'",
"pr_3" to "Target branch 'absent' not found in '$PROJECT:$REPOSITORY'"
"pr_2" to "Source branch 'absent' not found in '$project:$repository'",
"pr_3" to "Target branch 'absent' not found in '$project:$repository'"
)
}
}

0 comments on commit 5147d81

Please sign in to comment.