-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Wave container freeze
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Loading branch information
1 parent
6307f9b
commit 9a5903e
Showing
6 changed files
with
80 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,29 @@ class WaveClientTest extends Specification { | |
!req.condaFile | ||
!req.spackFile | ||
!req.containerConfig.layers | ||
!req.freeze | ||
and: | ||
req.fingerprint == 'bd2cb4b32df41f2d290ce2366609f2ad' | ||
req.timestamp instanceof String | ||
} | ||
|
||
def 'should create request object with freeze mode' () { | ||
given: | ||
def session = Mock(Session) { getConfig() >> [wave:[freeze:true]]} | ||
def IMAGE = 'foo:latest' | ||
def wave = new WaveClient(session) | ||
|
||
when: | ||
def req = wave.makeRequest(WaveAssets.fromImage(IMAGE)) | ||
then: | ||
req.containerImage == IMAGE | ||
!req.containerPlatform | ||
!req.containerFile | ||
!req.condaFile | ||
!req.spackFile | ||
!req.containerConfig.layers | ||
and: | ||
req.freeze | ||
and: | ||
req.fingerprint == 'bd2cb4b32df41f2d290ce2366609f2ad' | ||
req.timestamp instanceof String | ||
|
@@ -850,150 +873,4 @@ class WaveClientTest extends Specification { | |
'http://foo.com' | false | ||
} | ||
|
||
@Unroll | ||
def 'should find wave token' () { | ||
given: | ||
def sess = Mock(Session) {getConfig() >> [wave:[endpoint: 'http://foo.com']] } | ||
and: | ||
def wave = Spy(new WaveClient(sess)) | ||
|
||
expect: | ||
wave.getWaveToken(CONTAINER) == EXPECTED | ||
|
||
where: | ||
EXPECTED | CONTAINER | ||
null | null | ||
null | 'ubunutu:latest' | ||
null | 'xyz.com/wt/3aec54700cff/wave-build-repo:rnaseq-nf_v1.0' | ||
and: | ||
'3aec54700cff' | 'foo.com/wt/3aec54700cff/wave-build-repo:rnaseq-nf_v1.0' | ||
} | ||
|
||
def 'should convert json to describe container response'() { | ||
given: | ||
def JSON = ''' | ||
{ | ||
"token": "3aec54700cff", | ||
"expiration": "2023-03-02T18:07:50.488226285Z", | ||
"request": { | ||
"user": { | ||
"id": 8083, | ||
"userName": "pditommaso", | ||
"email": "[email protected]" | ||
}, | ||
"workspaceId": 88265370860066, | ||
"containerImage": "1234567890.dkr.ecr.us-west-2.amazonaws.com/wave-build-repo:rnaseq-nf_v1.0", | ||
"containerConfig": { | ||
"entrypoint": [ | ||
"/opt/fusion/entrypoint.sh" | ||
], | ||
"layers": [ | ||
{ | ||
"location": "data:DATA+OMITTED", | ||
"gzipDigest": "sha256:dc8dd4ebf839869abb81d35fe3f265de9f3ac7b9b285e274c6b92072b02a84ec", | ||
"gzipSize": 202, | ||
"tarDigest": "sha256:dc4d652cd223da5bca40d08890686c4198769fb7bfc09de2ed3c3c77dead4bf9" | ||
}, | ||
{ | ||
"location": "https://fusionfs.seqera.io/releases/pkg/0/6/4/fusionfs-amd64.tar.gz", | ||
"gzipDigest": "sha256:c55640ae3284715e5c7a1c1f6c6ec2de77a881a08f5a9c46f077ecd0379e8477", | ||
"gzipSize": 6191418, | ||
"tarDigest": "sha256:e24642d65d5b21987666cf1ce4ba007ecadedbcefae9601669ab43a566682aa6" | ||
} | ||
] | ||
}, | ||
"towerEndpoint": "https://api.tower.nf", | ||
"fingerprint": "779855a0ffc582ef3170f7dab8829465", | ||
"timestamp": "2023-03-01T20:07:49.933811174Z", | ||
"zoneId": "Z", | ||
"ipAddress": "54.190.237.226" | ||
}, | ||
"build": { | ||
"buildRepository": "1234567890.dkr.ecr.us-west-2.amazonaws.com/wave-build-repo", | ||
"cacheRepository": "1234567890.dkr.ecr.us-west-2.amazonaws.com/wave-cache-repo" | ||
}, | ||
"source": { | ||
"image": "1234567890.dkr.ecr.us-west-2.amazonaws.com/wave-build-repo:rnaseq-nf_v1.0", | ||
"digest": "sha256:d6f56ed0eae171fabd324bf582dd5c49c6462662c80a7e69632c57043b6af143" | ||
}, | ||
"wave": { | ||
"image": "wave.seqera.io/wt/3aec54700cff/wave-build-repo:rnaseq-nf_v1.0", | ||
"digest": "sha256:d8f4f9aa77b4d1941b50a050ed71473a0e04720f38a12d497557c39a25398830" | ||
} | ||
} | ||
''' | ||
and: | ||
def sess = Mock(Session) {getConfig() >> [:] } | ||
def wave = Spy(new WaveClient(sess)) | ||
|
||
when: | ||
def resp = wave.jsonToDescribeContainerResponse(JSON) | ||
then: | ||
resp.token == '3aec54700cff' | ||
and: | ||
resp.wave.image == 'wave.seqera.io/wt/3aec54700cff/wave-build-repo:rnaseq-nf_v1.0' | ||
resp.wave.digest == 'sha256:d8f4f9aa77b4d1941b50a050ed71473a0e04720f38a12d497557c39a25398830' | ||
and: | ||
resp.request.user.id == 8083 | ||
resp.request.user.userName == 'pditommaso' | ||
|
||
} | ||
|
||
def 'should resolve wave container' () { | ||
given: | ||
def RESP1 = ''' | ||
{ | ||
"token": "3aec54700cff", | ||
"source": { | ||
"image": "docker.io/library/ubuntu:latest", | ||
"digest": "sha256:d6f56ed0eae171fabd324bf582dd5c49c6462662c80a7e69632c57043b6af143" | ||
}, | ||
"wave": { | ||
"image": "wave.seqera.io/wt/3aec54700cff/library/ubuntu:latest", | ||
"digest": "sha256:d8f4f9aa77b4d1941b50a050ed71473a0e04720f38a12d497557c39a25398830" | ||
} | ||
} | ||
''' | ||
and: | ||
def sess = Mock(Session) {getConfig() >> [:] } | ||
def wave = Spy(new WaveClient(sess)) | ||
|
||
when: | ||
def result = wave.resolveSourceContainer('ubuntu') | ||
then: | ||
0 * wave.fetchContainerInfo(_) >> null | ||
result == 'ubuntu' | ||
|
||
when: | ||
result = wave.resolveSourceContainer('wave.seqera.io/wt/3aec54700cff/library/ubuntu:latest') | ||
then: | ||
1 * wave.fetchContainerInfo('3aec54700cff') >> RESP1 | ||
result == 'wave.seqera.io/wt/3aec54700cff/library/ubuntu@sha256:d8f4f9aa77b4d1941b50a050ed71473a0e04720f38a12d497557c39a25398830' | ||
} | ||
|
||
def 'should return source container' () { | ||
given: | ||
def RESP = ''' | ||
{ | ||
"token": "3aec54700cff", | ||
"source": { | ||
"image": "docker.io/library/ubuntu:latest", | ||
"digest": "sha256:d6f56ed0eae171fabd324bf582dd5c49c6462662c80a7e69632c57043b6af143" | ||
}, | ||
"wave": { | ||
"image": "wave.seqera.io/wt/3aec54700cff/library/ubuntu:latest", | ||
"digest": "sha256:d6f56ed0eae171fabd324bf582dd5c49c6462662c80a7e69632c57043b6af143" | ||
} | ||
} | ||
''' | ||
and: | ||
def sess = Mock(Session) {getConfig() >> [:] } | ||
def wave = Spy(new WaveClient(sess)) | ||
|
||
when: | ||
def result = wave.resolveSourceContainer('wave.seqera.io/wt/3aec54700cff/library/ubuntu:latest') | ||
then: | ||
1 * wave.fetchContainerInfo('3aec54700cff') >> RESP | ||
result == 'docker.io/library/ubuntu@sha256:d6f56ed0eae171fabd324bf582dd5c49c6462662c80a7e69632c57043b6af143' | ||
} | ||
} |