Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
munishchouhan committed Sep 25, 2023
1 parent d9aa6bc commit 29491c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ public class SubmitContainerTokenRequest implements Cloneable {
*/
public String format;

/**
* When {@code true} build requests are carried out in dry-run mode.
* Id of workflow in tower
*/
public Boolean dryRun;
/**
* Id of workflow in tower
*/
Expand Down Expand Up @@ -248,6 +253,11 @@ public SubmitContainerTokenRequest withFormat(String value) {
return this;
}

public SubmitContainerTokenRequest withDryRun(Boolean dryRun) {
this.dryRun = dryRun;
return this;
}

public boolean formatSingularity() {
return "sif".equals(format);
}
Expand All @@ -272,6 +282,7 @@ public String toString() {
", freeze=" + freeze +
", buildContext=" + buildContext +
", type=" + format +
", dryRun=" + dryRun +
", towerWorkflowId=" + towerWorkflowId +
'}';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class SubmitContainerTokenRequestTest extends Specification {
fingerprint: 'a14',
freeze: true,
format: 'sif',
dryRun: false,
towerWorkflowId: 'id123'
)

Expand All @@ -60,7 +61,10 @@ class SubmitContainerTokenRequestTest extends Specification {
copy.fingerprint == req.fingerprint
copy.freeze == req.freeze
copy.format == req.format
copy.dryRun == req.dryRun
copy.towerWorkflowId == req.towerWorkflowId
and:
copy.formatSingularity()

when:
def other = req.copyWith(
Expand All @@ -78,6 +82,7 @@ class SubmitContainerTokenRequestTest extends Specification {
cacheRepository: 'b12',
timestamp: 'b13',
fingerprint: 'b14',
dryRun: false,
freeze: false,
format: 'foo',
towerWorkflowId: 'id123'
Expand All @@ -99,7 +104,10 @@ class SubmitContainerTokenRequestTest extends Specification {
other.fingerprint == 'b14'
other.freeze == false
other.format == 'foo'
other.dryRun == false
other.towerWorkflowId == 'id123'
and:
!other.formatSingularity()
}

}

0 comments on commit 29491c8

Please sign in to comment.