Skip to content

Commit

Permalink
added inspect validation
Browse files Browse the repository at this point in the history
Signed-off-by: munishchouhan <[email protected]>
  • Loading branch information
munishchouhan committed Oct 16, 2024
1 parent 42e72e2 commit cff8585
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/io/seqera/wave/cli/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ protected void validateArgs() {
if( singularity && !freeze )
throw new IllegalCliArgumentException("Singularity build requires enabling freeze mode");

if( inspect && isEmpty(image) )
throw new IllegalCliArgumentException("Option --inspect requires the use of container image (--image)");

if( !isEmpty(contextDir) ) {
// check that a container file has been provided
if( isEmpty(containerFile) )
Expand Down
16 changes: 16 additions & 0 deletions app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -585,4 +585,20 @@ class AppTest extends Specification {
'2.0.0' | '2.1.0' | '2.0.0 (required: 2.1.0)'
}

def 'should fail when inspecting without container image' () {
given:
def app = new App()
String[] args = ["--conda-package", "bwa", "--freeze", "--singularity", "--inspect"]

when:
def cli = new CommandLine(app)
cli.parseArgs(args)
and:
app.validateArgs()
then:
def e = thrown(IllegalCliArgumentException)
and:
e.getMessage() == "Option --inspect requires the use of container image (--image)"
}

}

0 comments on commit cff8585

Please sign in to comment.