Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigonull committed Jun 12, 2024
1 parent d9d8ca0 commit 7aee520
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions jenkins-pipeline-shared-libraries/test/vars/CloudSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -817,30 +817,30 @@ http = false

def "[cloud.groovy] loginContainerRegistry default"() {
setup:
groovyScript.getBinding().setVariable("DOCKER_USER", 'user')
groovyScript.getBinding().setVariable("DOCKER_TOKEN", 'password')
groovyScript.getBinding().setVariable("REGISTRY_USER", 'user')
groovyScript.getBinding().setVariable("REGISTRY_TOKEN", 'password')
when:
groovyScript.loginContainerRegistry('REGISTRY', 'REGISTRY_USER_CREDS_ID', 'REGISTRY_TOKEN_CREDS_ID')
then:
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_USER_CREDS_ID', variable: 'DOCKER_USER']) >> 'user'
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_USER_CREDS_ID', variable: 'REGISTRY_USER']) >> 'user'
1 * getPipelineMock("withCredentials")(['user'], _ as Closure)
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_TOKEN_CREDS_ID', variable: 'DOCKER_TOKEN']) >> 'token'
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_TOKEN_CREDS_ID', variable: 'REGISTRY_TOKEN']) >> 'token'
1 * getPipelineMock("withCredentials")(['token'], _ as Closure)
1 * getPipelineMock("sh")("echo \"password\" | docker login -u \"user\" --password-stdin REGISTRY")
}

def "[cloud.groovy] loginContainerRegistry with container engine and options"() {
setup:
groovyScript.getBinding().setVariable("DOCKER_USER", 'user')
groovyScript.getBinding().setVariable("DOCKER_TOKEN", 'password')
groovyScript.getBinding().setVariable("REGISTRY_USER", 'user')
groovyScript.getBinding().setVariable("REGISTRY_TOKEN", 'password')
when:
groovyScript.loginContainerRegistry('REGISTRY', 'REGISTRY_USER_CREDS_ID', 'REGISTRY_TOKEN_CREDS_ID', 'podman', '--tls-verify=false')
then:
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_USER_CREDS_ID', variable: 'DOCKER_USER']) >> 'user'
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_USER_CREDS_ID', variable: 'REGISTRY_USER']) >> 'user'
1 * getPipelineMock("withCredentials")(['user'], _ as Closure)
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_TOKEN_CREDS_ID', variable: 'DOCKER_TOKEN']) >> 'token'
1 * getPipelineMock('string.call')([credentialsId: 'REGISTRY_TOKEN_CREDS_ID', variable: 'REGISTRY_TOKEN']) >> 'token'
1 * getPipelineMock("withCredentials")(['token'], _ as Closure)
1 * getPipelineMock("sh")("echo \"password\" | docker login -u \"user\" --password-stdin --tls-verify=false REGISTRY")
1 * getPipelineMock("sh")("echo \"password\" | podman login -u \"user\" --password-stdin --tls-verify=false REGISTRY")
}

/////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7aee520

Please sign in to comment.