Skip to content

Commit c6b2fec

Browse files
committed
test: expand parameterized test coverage for credential handling
Enhance the credential input test to cover all original scenarios: - Valid credentials should be accepted as-is - Null/empty inputs should default to 'sa' - Invalid secret patterns should throw exceptions Uses Spock's parameterized testing to maintain complete test coverage while keeping the test code concise and maintainable. Signed-off-by: Edmund Miller <[email protected]>
1 parent 017e0df commit c6b2fec

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

plugins/nf-sqldb/src/test/nextflow/sql/config/SqlDataSourceTest.groovy

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,17 @@ class SqlDataSourceTest extends Specification {
145145
pattern << ['secrets.ATHENA_USER', '[secret]']
146146
}
147147

148-
def 'should allow valid credentials' () {
148+
def 'should handle various credential inputs' () {
149149
when:
150-
def ds = new SqlDataSource([user: 'validuser', password: 'validpass'])
150+
def ds = new SqlDataSource([user: userInput, password: passInput])
151151
then:
152-
ds.user == 'validuser'
153-
ds.password == 'validpass'
152+
ds.user == expectedUser
153+
ds.password == expectedPass
154+
155+
where:
156+
userInput | passInput | expectedUser | expectedPass
157+
'validuser' | 'validpass' | 'validuser' | 'validpass'
158+
null | null | SqlDataSource.DEFAULT_USER| null
159+
'' | '' | SqlDataSource.DEFAULT_USER| null
154160
}
155161
}

0 commit comments

Comments
 (0)