Add docker.#Command tests
Tests : - docker version with ssh - docker version with ssh and key passphrase - docker version with ass and wrong key passphrase Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
parent
e540bd2716
commit
8a2fc9aa72
26
stdlib/.dagger/env/docker-command-ssh-key-passphrase/plan/command.cue
vendored
Normal file
26
stdlib/.dagger/env/docker-command-ssh-key-passphrase/plan/command.cue
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestConfig: {
|
||||||
|
host: string @dagger(input)
|
||||||
|
user: string @dagger(input)
|
||||||
|
key: dagger.#Secret @dagger(input)
|
||||||
|
keyPassphrase: dagger.#Secret @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
TestSSH: client: docker.#Command & {
|
||||||
|
command: #"""
|
||||||
|
docker $CMD
|
||||||
|
"""#
|
||||||
|
ssh: {
|
||||||
|
host: TestConfig.host
|
||||||
|
user: TestConfig.user
|
||||||
|
key: TestConfig.key
|
||||||
|
keyPassphrase: TestConfig.keyPassphrase
|
||||||
|
}
|
||||||
|
env: CMD: "version"
|
||||||
|
}
|
30
stdlib/.dagger/env/docker-command-ssh-key-passphrase/values.yaml
vendored
Normal file
30
stdlib/.dagger/env/docker-command-ssh-key-passphrase/values.yaml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: docker-command-ssh-key-passphrase
|
||||||
|
inputs:
|
||||||
|
TestConfig.host:
|
||||||
|
text: 143.198.64.230
|
||||||
|
TestConfig.key:
|
||||||
|
secret: ENC[AES256_GCM,data:pXfs6sc+ObCWZC5wHTcOX3PJYh1KLIPeq+CggNIg2LZhUDQdFgUbzn/8Jo6mX2XMhcB3fkg4hzZ1WihnThL+2x6P23gnta6YYqBVhvnC1enmh28XfqGEmDnYjD7eM6ZK41a1Q6VxQ/SfJPL/01KmE0mlB+CAGxJ4BL314p2g05l3Sxnf4cfPU3s4MC+ZJNgumj5LcogMSh6pqP1EJBDgXcL7Eh7lVq5ua38oXXXJc5aq0O9HlN65ZRuwVjmkCLbP34Z2+91XDaKBUBkmzRjuaI20MZfJn+d0gx3cAiYoDxdhjsAa83T2q50CXw9j/HEiSSPRRfNxTcJajLvTnUWJ1Hm2j3D1ptmRikjntwqeDK8BObunvQOebxx3Iqc+iAi32oKF+nSLyBu/CbGagg/TylvZxW2Y1+ZzCz9oSUkTsyHWXV9QCvjV9oiawxiteTEu/ODXmiCNU1tOlyIYT/6dAGFV2M+oaKWwEQ0gDdOO3y7Yf5Om3y6fLbTI2QKy3c0ZZdr/LRIEdMyt4OWn7ivvP4axXiZUkQjDUq+umgXV+lfdOKn+/sQ4wpkeZNe/udSHMs3rV+zEwN33zaLh7bfoUGnBxpXEs8aAU7/8zX/Jz3s=,iv:HkRMWpV/KlEdVdS7rhZXHuF40mks6KPYW4VzB7CvWuw=,tag:K58zcFb+4TgOKUn+4q/8CA==,type:str]
|
||||||
|
TestConfig.keyPassphrase:
|
||||||
|
secret: ENC[AES256_GCM,data:sD67l42Fqx8=,iv:PADCLxwy/eIwDLC0k2NUJYOTTrgFvra0EIKr0HvZpZg=,tag:ei88VxuqVBvz9ZLNhighQg==,type:str]
|
||||||
|
TestConfig.user:
|
||||||
|
text: daggerci
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBnYUJSamRXak9ob2p4OGll
|
||||||
|
NW9FczZBeVZRR25tQkUxWExrSVFTOUgrN25rCi9PWVY1dk4rSUN2Y3FIMmVkM01Q
|
||||||
|
cWdhQWxDY2JwOGUyOWpFYzR3aWM5NUUKLS0tIE0wUmt0b3hSQkVGM1RDOUxxUDJF
|
||||||
|
cW1kbGZveVlkQkJDL2xYbmFRNjZEK0UKrSrOB/RL5lki54j4GUCE2G3CCO/8jpMU
|
||||||
|
jfYkl7Yowb7kK3kKSNWORhB4ne3MEeGRZpJC8cvH7zjGvt/YYeU14A==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2021-06-10T10:28:49Z"
|
||||||
|
mac: ENC[AES256_GCM,data:EWeThEa/5eP0GQNJF7RC1mniejmnn0XNyoipkuiGdEaWcauuVUnHWzV58J/F82NQeiYr8JsFkDrz1rju4yynV51gAAf2kupE6DJDOjmh9O1O9SCMjP7iEvDwW2Tznjq6oXO8r3qVEf86vmIDnhnCINbrOKCPI/j83BtfwC0w1mw=,iv:KX0yZFUSJgZGkZ7jFBueySt2c6T4/r9/5PIK0Dyw2LU=,tag:ZCt1ZbL0mDREQZ9mQ2PR6Q==,type:str]
|
||||||
|
pgp: []
|
||||||
|
encrypted_suffix: secret
|
||||||
|
version: 3.7.1
|
26
stdlib/.dagger/env/docker-command-ssh-wrong-key-passphrase/plan/command.cue
vendored
Normal file
26
stdlib/.dagger/env/docker-command-ssh-wrong-key-passphrase/plan/command.cue
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestConfig: {
|
||||||
|
host: string @dagger(input)
|
||||||
|
user: string @dagger(input)
|
||||||
|
key: dagger.#Secret @dagger(input)
|
||||||
|
keyPassphrase: dagger.#Secret @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
TestSSH: client: docker.#Command & {
|
||||||
|
command: #"""
|
||||||
|
docker $CMD
|
||||||
|
"""#
|
||||||
|
ssh: {
|
||||||
|
host: TestConfig.host
|
||||||
|
user: TestConfig.user
|
||||||
|
key: TestConfig.key
|
||||||
|
keyPassphrase: TestConfig.keyPassphrase
|
||||||
|
}
|
||||||
|
env: CMD: "version"
|
||||||
|
}
|
30
stdlib/.dagger/env/docker-command-ssh-wrong-key-passphrase/values.yaml
vendored
Normal file
30
stdlib/.dagger/env/docker-command-ssh-wrong-key-passphrase/values.yaml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
name: docker-command-ssh-wrong-key-passphrase
|
||||||
|
inputs:
|
||||||
|
TestConfig.host:
|
||||||
|
text: 143.198.64.230
|
||||||
|
TestConfig.key:
|
||||||
|
secret: ENC[AES256_GCM,data:dbIEUHadOTOdPrmMAgyLGMdIY+FuyWZvv4mRyjr+BbLZavl7/fH6abiQFpPY0x3960iqPB+wEM6wG+VPDivHTj1QRVMGPIV8ZGrfeR/mfeDuaKXDttkWgRN8vyHOZ+oKnI22913tvK59gNbJX8fR0wPfqOCEWbzy+bRBh/bVH//CMwCoSU+v2rZwAqOnGyXCyeGbp+wo5xMufv+Dosgb4uhFk1CPQJfKfBJVMf1EJS0e9/P8GS5UUjevR9eeRnCJ7kdHu26b3lwAHhPWv72O/yuOIKItrgMkSuHz2H2BFdgt5xq/h/SfrONMwymg8+oEiuS3n1C8ZBv8I4RE5XF6GX/xWb9dZJLctbi6oBELtvKXhswnB0PWSK1OXMgrJ5yYFeBPpaBptRBxl0AJhOG92K6xM9O0cRxAT+vtz0zvJ7gIQDZtngcTTS+IMN6Kgmx4daW5x14FbRJRGKKqU+PHeUW2XpN70IwkWXZfLs445O9w8teayPUu3KePZJo8eLkVpWJIyVUnrk/5VIREV8EYZzRFUwTtwYSTefGycPfjz2L01xQR0fn55DxJpcLpCLqjGRhWHQE6Wn4j6aXyzbOXHMIYgw+Rx1egjszdKzgCWaA=,iv:CZyN1UCE0nI2/ch5O7kerfYBbCgoJX+dPvh5dRO3cxc=,tag:hwBmnOdC8Na0dwyUCU3QDw==,type:str]
|
||||||
|
TestConfig.keyPassphrase:
|
||||||
|
secret: ENC[AES256_GCM,data:LM8qBQ1uZHVA,iv:z4MOKWy9owo69oy8Z4Gmd7fT7uXMR/Sp2qgM38wjWM4=,tag:WwZt3WtlROY3+j2LG8M39w==,type:str]
|
||||||
|
TestConfig.user:
|
||||||
|
text: daggerci
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB2U0w2S2luTlJNbGhnd3FY
|
||||||
|
dmp4K2t6ZWR1Q1dYNCsvRWhZRkl4UWFoVEhRCmZHUHNBVW5LZEl1ckpGQmJlZEVP
|
||||||
|
LzEweFZrbWZoMDhBbGQ3eXdrbGtoNzAKLS0tIEhoWXZidi9yejFjaTlCOGo4Q1Bl
|
||||||
|
R2tNU2JJWHFQTmhnUDd6eE13UUhQazgK+OQ50Q3+S5Fn2Y132ZeDrgUKWPcAk+et
|
||||||
|
q8ppfZiPOtH4p6MwboSuh/vaTAAsxks7ctnqnU1pY+EHfnp8bHYHgQ==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2021-06-10T15:09:45Z"
|
||||||
|
mac: ENC[AES256_GCM,data:axraLjtO6zs1Zo2UVcrxJqLHlQea1pBcGCwCxIp43vw+L07haNtuqf0lJ5SL9XfB/yGjYtykP+Ld1evbgnUT4nqxRuHkN2NgHshmrytdptnOKCuTqE4sYWRt5Nny2linXmsqAYS9HAw8htw0DOjFUDruIAITjVLb8/sSgvS7wb4=,iv:Ahqguwy+9gmIzUMxDLzf9JuNybst+cMabfDciL5ZeJ4=,tag:EggVqFtbqLjMyHhrmqY1Ug==,type:str]
|
||||||
|
pgp: []
|
||||||
|
encrypted_suffix: secret
|
||||||
|
version: 3.7.1
|
2
stdlib/.dagger/env/docker-command-ssh/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/docker-command-ssh/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# dagger state
|
||||||
|
state/**
|
24
stdlib/.dagger/env/docker-command-ssh/plan/command.cue
vendored
Normal file
24
stdlib/.dagger/env/docker-command-ssh/plan/command.cue
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
"dagger.io/docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
TestConfig: {
|
||||||
|
host: string @dagger(input)
|
||||||
|
user: string @dagger(input)
|
||||||
|
key: dagger.#Secret @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
|
TestSSH: client: docker.#Command & {
|
||||||
|
command: #"""
|
||||||
|
docker $CMD
|
||||||
|
"""#
|
||||||
|
ssh: {
|
||||||
|
host: TestConfig.host
|
||||||
|
user: TestConfig.user
|
||||||
|
key: TestConfig.key
|
||||||
|
}
|
||||||
|
env: CMD: "version"
|
||||||
|
}
|
28
stdlib/.dagger/env/docker-command-ssh/values.yaml
vendored
Normal file
28
stdlib/.dagger/env/docker-command-ssh/values.yaml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: docker-command-ssh
|
||||||
|
inputs:
|
||||||
|
TestConfig.host:
|
||||||
|
text: 143.198.64.230
|
||||||
|
TestConfig.key:
|
||||||
|
secret: ENC[AES256_GCM,data:gb2yFGdX3oqjPpQmqn3gr0hqLAHMFBhzLEHI5Bi+VN5Op/SCSjfA5yEC0Olb/Brzssjp0i6PIPBPPwW+Pj/gDuSR6CqzGlAkF1Pz/Ks6R0zqWkcR0gFImXrfRzeflgpGagPBgPsRBtPcoY7WqJQ1Lue46cJe7OTNPRT+X9oDek7mk9ZiIpJCUQQVN0+alWStOPYuTjRlqcSfao+B6hnC2fMtcCWpVxz9Sj8UpSwX4EHLU5GsHr8ioD+BP7BCPlhP/aSKu1iwMaiMo6zRn6V+GtSGX4JrwN53CYSjGxi1g9RiFMCFxcWsDVA+hCnzAdzO3pMEmTL5xHZ9MoMLbOwEhN3Rnh+HX61uTq2DRfqGhKGtjXjcewOxb0NezGCj93Y0ov2TtBBo7wjYEi0AmI3ljCwoq9EDRYKg1a/w79FpGVpqoomd4XrJYbqP0SnHO0ZrsSLqKmqdIoDYbfxR7zprQQsN0ENOdDVf9WdTnHSJMSC5MTmyqAOogKZN1nNzW5LJQ2i0JUt1jl322RzdQ+brBLWiohVfenCy/23l,iv:gceSEfG6Eu2Pc9+JZpH0CLITNVnYFyN21drPneu15wk=,tag:zmYtioa5LTPZrSeFNmaBvg==,type:str]
|
||||||
|
TestConfig.user:
|
||||||
|
text: daggerci
|
||||||
|
sops:
|
||||||
|
kms: []
|
||||||
|
gcp_kms: []
|
||||||
|
azure_kv: []
|
||||||
|
hc_vault: []
|
||||||
|
age:
|
||||||
|
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBJSU5uMDBNdDEzQXFsb2ZS
|
||||||
|
VDRDai9yOHFPSnI4dXhDY0FUcXVkRXdMMXdBCnhSTER5bEJRRDNZbStVTTk5d2FN
|
||||||
|
MUxkM1JpQ3NHa3B4MHlnZ1dDU1RoS2cKLS0tIE9Xa1ovQkRSZlBZMjZlZi9OUGhG
|
||||||
|
UEpoZy9HZUlHOVV3M05OSkZQS1l6aXcK3NfBITvd6la6nkcIzqH69xfv9RR0Jm7x
|
||||||
|
vU5FvGROK3Z0ZR8NNXAtNH6VQQ21TDD2MOXWOVvjnIAAOVNEyc1amA==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2021-06-10T10:32:51Z"
|
||||||
|
mac: ENC[AES256_GCM,data:4npSJpiOpaYIFig5AB4mhVheKhS7VtP65PCPamsg9qLKmTefdFvby6mcMrtghlbmYb/78I2UlA09UMDtO2y7N9vtD1p+xdu3Tz/iD1zJpRpARIyOCEuI7L1jDBeC/jnA0C9JcEQ6hTH6YTXtqxTjE49Uu8KCj4nsUPRIKYVdaYM=,iv:+3mNHpXYjFCbuYKnDnmqGishNhchH9OpeLclPqrZ3Wg=,tag:+xC34ClE6a1/vx35m3vp1g==,type:str]
|
||||||
|
pgp: []
|
||||||
|
encrypted_suffix: secret
|
||||||
|
version: 3.7.1
|
@ -41,20 +41,26 @@ import (
|
|||||||
// Mount content from other artifacts
|
// Mount content from other artifacts
|
||||||
mount: {
|
mount: {
|
||||||
[string]: {
|
[string]: {
|
||||||
from: dagger.#Artifact
|
from: dagger.#Artifact
|
||||||
} | {
|
} | {
|
||||||
secret: dagger.#Secret
|
secret: dagger.#Secret
|
||||||
} @dagger(input)
|
} @dagger(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount persistent cache directories
|
// Mount persistent cache directories
|
||||||
cache: [string]: true @dagger(input)
|
cache: {
|
||||||
|
[string]: true @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
// Mount temporary directories
|
// Mount temporary directories
|
||||||
tmpfs: [string]: true @dagger(input)
|
tmpfs: {
|
||||||
|
[string]: true @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
// Additional packages to install
|
// Additional packages to install
|
||||||
package: [string]: true | false | string @dagger(input)
|
package: {
|
||||||
|
[string]: true | false | string @dagger(input)
|
||||||
|
}
|
||||||
|
|
||||||
// Setup docker client and then execute the user command
|
// Setup docker client and then execute the user command
|
||||||
#code: #"""
|
#code: #"""
|
||||||
@ -175,4 +181,4 @@ import (
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,19 @@ setup() {
|
|||||||
dagger -e docker-run-local up
|
dagger -e docker-run-local up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "docker command: ssh" {
|
||||||
|
dagger -e docker-command-ssh up
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "docker command: ssh with key passphrase" {
|
||||||
|
dagger -e docker-command-ssh-key-passphrase up
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "docker command: ssh with wrong key passphrase" {
|
||||||
|
run dagger -e docker-command-ssh-wrong-key-passphrase up
|
||||||
|
assert_failure
|
||||||
|
}
|
||||||
|
|
||||||
@test "docker run: ssh" {
|
@test "docker run: ssh" {
|
||||||
dagger -e docker-run-ssh up
|
dagger -e docker-run-ssh up
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user