This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/stdlib/docker/compose/tests/compose.cue

85 lines
1.3 KiB
CUE
Raw Normal View History

package compose
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/docker"
"alpha.dagger.io/random"
)
repo: dagger.#Artifact @dagger(input)
TestSSH: {
key: dagger.#Secret @dagger(input)
host: string @dagger(input)
user: string @dagger(input)
}
TestCompose: {
suffix: random.#String & {seed: "cmp"}
name: "compose_test_\(suffix.out)"
up: #App & {
ssh: {
key: TestSSH.key
host: TestSSH.host
user: TestSSH.user
}
source: repo
"name": name
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "\#(name)_api" | grep "Up"
"""#
}
cleanup: #CleanupCompose & {
context: up.run
"name": name
ssh: verify.ssh
}
}
TestInlineCompose: {
suffix: random.#String & {seed: "cmp-inline"}
name: "inline_test_\(suffix.out)"
up: #App & {
ssh: {
key: TestSSH.key
host: TestSSH.host
user: TestSSH.user
}
source: repo
"name": name
composeFile: #"""
version: "3"
services:
api-mix:
build: .
environment:
PORT: 7000
ports:
- 7000:7000
"""#
}
verify: docker.#Command & {
ssh: up.run.ssh
command: #"""
docker container ls | grep "\#(name)_api-mix" | grep "Up"
"""#
}
cleanup: #CleanupCompose & {
context: up.run
"name": name
ssh: verify.ssh
}
}