Add tests on AWS s3 upload directory

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-04-22 20:57:00 +02:00
parent 226be80d56
commit b3c29acb34
5 changed files with 29 additions and 4 deletions

View File

@ -41,5 +41,5 @@ setup() {
@test "stdlib: s3" {
skip_unless_secrets_available "$TESTDIR"/stdlib/aws/inputs.yaml
"$DAGGER" compute "$TESTDIR"/stdlib/aws/s3 --input-yaml "$TESTDIR"/stdlib/aws/inputs.yaml
"$DAGGER" compute "$TESTDIR"/stdlib/aws/s3 --input-dir TestDirectory="$TESTDIR"/stdlib/aws/s3/testdata --input-yaml "$TESTDIR"/stdlib/aws/inputs.yaml
}

View File

@ -1,6 +1,7 @@
package s3
import (
"dagger.io/dagger"
"dagger.io/aws"
"dagger.io/aws/s3"
)
@ -20,5 +21,25 @@ TestS3UploadFile: {
target: "s3://\(bucket)/test.txt"
}
verify: #VerifyS3
verify: #VerifyS3 & {
file: "test.txt"
}
}
TestDirectory: dagger.#Artifact
TestS3UploadDir: {
deploy: s3.#Put & {
config: TestConfig.awsConfig
source: TestDirectory
target: "s3://\(bucket)/"
}
verifyFile: #VerifyS3 & {
file: "dirFile.txt"
}
verifyDir: #VerifyS3 & {
file: "foo.txt"
}
}

View File

@ -0,0 +1 @@
Test recursivity

View File

@ -0,0 +1 @@
Test directory

View File

@ -19,12 +19,14 @@ import (
// Script
aws.#Script & {
code: """
aws s3 ls \(target) > /contents
aws s3 ls --recursive \(target) >> /contents
"""
}
}
#VerifyS3: {
file: string
lists: #List & {
config: TestConfig.awsConfig
target: "s3://\(bucket)"
@ -32,7 +34,7 @@ import (
#CheckFiles:
"""
grep -q test.txt /test
grep -q \(file) /test
"""
test: #up: [