Skip to content

Commit

Permalink
[#44] Workaround issue with bypassed retry mechanism
Browse files Browse the repository at this point in the history
Introduced with sharing stagingRepositoryId. Will be fixed by #21.
  • Loading branch information
szpak committed Mar 20, 2017
1 parent 9900b7a commit ee0fc34
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PromoteRepositoryTask extends BaseStagingTask {
private String getRepositoryIdFromCloseTaskOrFromServer(String stagingProfileId, RepositoryFetcher repositoryFetcher) {
//TODO: Add debug statement
OperationRetrier<String> retrier = createOperationRetrier()
String repositoryId = getCloseRepositoryTask().stagingRepositoryId ?:
String repositoryId = /*getCloseRepositoryTask().stagingRepositoryId ?:*/ //Temporary disabled due to https://github.com/Codearte/gradle-nexus-staging-plugin/issues/44
retrier.doWithRetry { repositoryFetcher.getClosedRepositoryIdForStagingProfileId(stagingProfileId) }
return repositoryId
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import io.codearte.gradle.nexus.logic.FetcherResponseTrait
import nebula.test.functional.ExecutionResult
import org.gradle.api.logging.LogLevel
import org.junit.Rule
import spock.lang.Ignore
import spock.lang.Issue

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
import static com.github.tomakehurst.wiremock.client.WireMock.containing
Expand Down Expand Up @@ -84,6 +86,32 @@ class MockedFunctionalSpec extends BaseNexusStagingFunctionalSpec implements Fet
"promoteRepository" | "closed"
}

//TODO: Remove when 'stagingProfileId AND stagingRepositoryId' case is fixed
def "should reuse stagingProfileId from closeRepository in promoteRepository when called together"() {
given:
stubGetStagingProfilesWithJson(this.getClass().getResource("/io/codearte/gradle/nexus/logic/2stagingProfilesShrunkResponse.json").text)
and:
stubGetOneOpenRepositoryInFirstCallAndOneClosedInTheNext(stagingProfileId)
and:
stubSuccessfulCloseRepositoryWithProfileId(stagingProfileId)
and:
stubSuccessfulPromoteRepositoryWithProfileId(stagingProfileId)
and:
buildFile << """
${getApplyPluginBlock()}
${getDefaultConfigurationClosure()}
""".stripIndent()
when:
ExecutionResult result = runTasksSuccessfully("closeRepository", "promoteRepository")
then:
result.wasExecuted("closeRepository")
result.wasExecuted("promoteRepository")
and:
verify(2, getRequestedFor(urlEqualTo("/staging/profile_repositories/$stagingProfileId")))
verify(1, getRequestedFor(urlEqualTo("/staging/profiles")))
}

@Ignore("Due to https://github.com/Codearte/gradle-nexus-staging-plugin/issues/44")
def "should reuse stagingProfileId AND stagingRepositoryId from closeRepository in promoteRepository when called together"() {
given:
stubGetStagingProfilesWithJson(this.getClass().getResource("/io/codearte/gradle/nexus/logic/2stagingProfilesShrunkResponse.json").text)
Expand Down Expand Up @@ -166,7 +194,8 @@ class MockedFunctionalSpec extends BaseNexusStagingFunctionalSpec implements Fet

def "should call close and promote in closeAndPromoteRepository task"() {
given:
stubGetOneOpenRepositoryAndOneClosedInFirstCallAndTwoClosedInTheNext(stagingProfileId)
// stubGetOneOpenRepositoryAndOneClosedInFirstCallAndTwoClosedInTheNext(stagingProfileId) //TODO: Temporary disabled due to #44
stubGetOneOpenRepositoryInFirstCallAndOneClosedInTheNext(stagingProfileId)
and:
stubSuccessfulCloseRepositoryWithProfileId(stagingProfileId)
and:
Expand Down

0 comments on commit ee0fc34

Please sign in to comment.