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 b3c29acb34 Add tests on AWS s3 upload directory
Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
2021-04-22 20:57:00 +02:00

70 lines
908 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 --recursive \(target) >> /contents
"""
}
}
#VerifyS3: {
file: string
lists: #List & {
config: TestConfig.awsConfig
target: "s3://\(bucket)"
}
#CheckFiles:
"""
grep -q \(file) /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",
]
},
]
}