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/tests/stdlib/aws/s3/verify.cue
Tom Chauveau d5aa68fe2b Add test on AWS s3
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-04-22 19:18:26 +02:00

68 lines
881 B
CUE

package s3
import (
"dagger.io/aws"
"dagger.io/alpine"
"dagger.io/dagger/op"
)
#List: {
// AWS Config
config: aws.#Config
// Target S3 URL (e.g. s3://<bucket-name>/<path>/<sub-path>)
target?: string
// Export folder
export: "/contents"
// Script
aws.#Script & {
code: """
aws s3 ls \(target) > /contents
"""
}
}
#VerifyS3: {
lists: #List & {
config: TestConfig.awsConfig
target: "s3://\(bucket)"
}
#CheckFiles:
"""
grep -q test.txt /test
"""
test: #up: [
op.#Load & {
from: alpine.#Image & {
package: bash: "~5.1"
}
},
op.#WriteFile & {
dest: "/test"
content: lists.out
},
op.#WriteFile & {
dest: "/checkFiles.sh"
content: #CheckFiles
},
op.#Exec & {
always: true
args: [
"/bin/bash",
"--noprofile",
"--norc",
"-eo",
"pipefail",
"/checkFiles.sh",
]
},
]
}