added test for docker run with ports

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones 2021-09-28 09:33:02 -06:00
parent eadaf73d3c
commit d496b77c71
No known key found for this signature in database
GPG Key ID: CFB3A382EB166F4C
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,2 @@
# dagger state
state/**

View File

@ -0,0 +1,23 @@
plan:
package: ./docker/tests/run-ports
name: docker-run-ports
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpbHY3ZzZjWWdRcVd5UUdT
eFI4UmhTUkd6a0lscDZ3SzVFT2NiSzFRUHhFCnRsRXorSFhjano1WTcrYjlGZElm
S2o1V005SlpSbHBmbjJNZ1I3VTRXVGMKLS0tIEdlMThjcmNGK3VJdXV4anNud21x
TS80V3BnN3BaeDFTRjNBRTAwbWRKcWcK1rH2zWxTQsbSgOs9Ys89ZCP7kVOm1wFe
Kv849q+QOvIy9JPYkGgV16Yr3ijFF7z/h0PCicZRI76WYV/3JnbYmg==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-09-28T15:06:47Z"
mac: ENC[AES256_GCM,data:WF2X4RCio9x459Fv4XK/P933cS9uac3kHA2+kfaft++ndxbHOY0zmOhUvNMmzLtJNTXL7oBADWIIqIiFbaaC0pC+xGq1th+woR3LvAVQi5J0rlDTcdMDPT03KOPdOmsXFDow5jzyn8vPsC59VCys0ZmEnmnHIGufnFy2qKVV0bM=,iv:GUrSk66zhDqxx+rVM9zMDfmcaDBSOOMIeCSViS2cuLU=,tag:rgCoWe//hn8xmeRmbc5ybQ==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1

View File

@ -0,0 +1,17 @@
package docker
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/random"
)
suffix: random.#String & {
seed: ""
}
run: #Run & {
name: "daggerci-test-ports-\(suffix.out)"
ref: "nginx"
socket: dagger.#Stream & {unix: "/var/run/docker.sock"}
ports: ["8080:80"]
}

View File

@ -79,6 +79,15 @@ setup() {
dagger -e docker-run-local up dagger -e docker-run-local up
} }
@test "docker run: ports" {
dagger -e docker-run-ports up
CONTAINER=$(docker container ls -q --filter "name=daggerci-test-ports-*")
until docker inspect --format "{{json .State.Status }}" $CONTAINER | grep -m 1 "running"; do sleep 1 ; done
run curl -f -LI http://localhost:8080
assert_output --partial '200 OK'
docker stop $CONTAINER && docker rm $CONTAINER
}
@test "docker build" { @test "docker build" {
dagger -e docker-build up dagger -e docker-build up
} }