alpine: cleanup tests

Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
Solomon Hykes 2022-02-08 23:29:00 +00:00
parent e6b5fd3de9
commit cf6fadbeda
5 changed files with 61 additions and 66 deletions

View File

@ -1,10 +0,0 @@
setup() {
load '../../bats_helpers'
common_setup
}
@test "alpine.#Build" {
dagger up ./image-version.cue
dagger up ./package-install.cue
}

View File

@ -1,22 +0,0 @@
package test
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/alpine"
)
dagger.#Plan & {
actions: {
build: alpine.#Build & {
// install an old version on purpose
version: "3.10.9"
}
check: engine.#Readfile & {
input: build.output.rootfs
path: "/etc/alpine-release"
contents: "3.10.9\n"
}
}
}

View File

@ -1,34 +0,0 @@
package test
import (
"dagger.io/dagger"
"universe.dagger.io/alpine"
"universe.dagger.io/docker"
)
dagger.#Plan & {
actions: {
build: alpine.#Build & {
packages: {
jq: {}
curl: {}
}
}
check: docker.#Run & {
image: build.output
command: {
name: "sh"
flags: "-c": """
jq --version > /jq-version.txt
curl --version > /curl-version.txt
"""
}
export: files: {
"/jq-version.txt": contents: =~"^jq"
"/curl-version.txt": contents: =~"^curl"
}
}
}
}

View File

@ -0,0 +1,8 @@
setup() {
load '../../bats_helpers'
common_setup
}
@test "alpine" {
dagger up
}

View File

@ -0,0 +1,53 @@
package alpine
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/alpine"
"universe.dagger.io/docker"
)
dagger.#Plan & {
actions: tests: {
// Test: customize alpine version
alpineVersion: {
build: alpine.#Build & {
// install an old version on purpose
version: "3.10.9"
}
verify: engine.#Readfile & {
input: build.output.rootfs
path: "/etc/alpine-release"
contents: "3.10.9\n"
}
}
// Test: install packages
packageInstall: {
build: alpine.#Build & {
packages: {
jq: {}
curl: {}
}
}
check: docker.#Run & {
image: build.output
command: {
name: "sh"
flags: "-c": """
jq --version > /jq-version.txt
curl --version > /curl-version.txt
"""
}
export: files: {
"/jq-version.txt": contents: =~"^jq"
"/curl-version.txt": contents: =~"^curl"
}
}
}
}
}