Skip to content

Commit 77c2bf4

Browse files
test: readBytes image test for Gitea and Azure
Signed-off-by: Nathan Johnson <nathan.johnson@seqera.io>
1 parent b7fa6f4 commit 77c2bf4

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

modules/nextflow/src/test/groovy/nextflow/scm/AzureRepositoryProviderTest.groovy

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import nextflow.exception.AbortOperationException
2020
import spock.lang.IgnoreIf
2121
import spock.lang.Requires
2222
import spock.lang.Specification
23+
24+
import javax.imageio.ImageIO
25+
import javax.imageio.stream.MemoryCacheImageInputStream
26+
2327
/**
2428
*
2529
* @author Tobias Neumann <tobias.neumann.at@gmail.com>
@@ -135,6 +139,26 @@ class AzureRepositoryProviderTest extends Specification {
135139
result == 'println "Hello from Azure repos!"'
136140
}
137141

142+
@IgnoreIf({System.getenv('NXF_SMOKE')})
143+
@Requires({System.getenv('NXF_AZURE_REPOS_TOKEN')})
144+
def 'should read bytes file content'() {
145+
given:
146+
def token = System.getenv('NXF_AZURE_REPOS_TOKEN')
147+
def config = new ProviderConfig('azurerepos').setAuth(token)
148+
149+
when:
150+
// uses repo at https://dev.azure.com/seqera-pipelines-dev/_git/rnaseq
151+
def repo = new AzureRepositoryProvider('seqera-pipelines-dev/rnaseq', config)
152+
def result = repo.readBytes('/docs/images/nf-core-rnaseq_logo_light.png')
153+
154+
then:
155+
def inputStream = new ByteArrayInputStream(result)
156+
def imageInput = new MemoryCacheImageInputStream(inputStream)
157+
final readers = ImageIO.getImageReaders(imageInput)
158+
readers.hasNext()
159+
}
160+
161+
138162
@IgnoreIf({System.getenv('NXF_SMOKE')})
139163
@Requires({System.getenv('NXF_AZURE_REPOS_TOKEN')})
140164
def 'should fetch repo tags'() {

modules/nextflow/src/test/groovy/nextflow/scm/GiteaRepositoryProviderTest.groovy

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ package nextflow.scm
1919
import spock.lang.IgnoreIf
2020
import spock.lang.Requires
2121
import spock.lang.Specification
22+
23+
import javax.imageio.ImageIO
24+
import javax.imageio.stream.MemoryCacheImageInputStream
25+
2226
/**
2327
*
2428
* @author Akira Sekiguchi <pachiras.yokohama@gmail.com>
@@ -106,4 +110,22 @@ class GiteaRepositoryProviderTest extends Specification {
106110
result == DATA
107111
}
108112

113+
114+
@IgnoreIf({System.getenv('NXF_SMOKE')})
115+
@Requires({System.getenv('NXF_AZURE_REPOS_TOKEN')})
116+
def 'should read bytes file content'() {
117+
given:
118+
def token = System.getenv('NXF_GITEA_ACCESS_TOKEN')
119+
def config = new ProviderConfig('gitea', new ConfigSlurper().parse(CONFIG).providers.mygitea as ConfigObject).setAuth(token)
120+
121+
when:
122+
def repo = new GiteaRepositoryProvider('swingingsimiangitea/rnaseq', config)
123+
def result = repo.readBytes('docs/images/nf-core-rnaseq_logo_light.png')
124+
125+
then:
126+
def inputStream = new ByteArrayInputStream(result)
127+
def imageInput = new MemoryCacheImageInputStream(inputStream)
128+
final readers = ImageIO.getImageReaders(imageInput)
129+
readers.hasNext()
130+
}
109131
}

0 commit comments

Comments
 (0)