mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-26 04:22:05 +02:00
test: remove bucket after test
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
ad7df518b6
commit
722343125a
35
Taskfile.yml
Normal file
35
Taskfile.yml
Normal file
@ -0,0 +1,35 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
dev:
|
||||
cmds:
|
||||
- cp -f scripts/pre-commit.sh .git/hooks/pre-commit
|
||||
|
||||
setup:
|
||||
cmds:
|
||||
- go mod tidy
|
||||
|
||||
fmt:
|
||||
cmds:
|
||||
- gofumpt -w -s -l .
|
||||
|
||||
test:
|
||||
vars:
|
||||
TEST_OPTIONS: ''
|
||||
TEST_PATTERN: '.'
|
||||
SOURCE_FILES: './...'
|
||||
env:
|
||||
LC_ALL: C
|
||||
cmds:
|
||||
- 'go test {{.TEST_OPTIONS}} -failfast -race -coverpkg={{.SOURCE_FILES}} -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -timeout=5m -run {{.TEST_PATTERN}}'
|
||||
|
||||
cover:
|
||||
deps: [test]
|
||||
cmds:
|
||||
- go tool cover -html=coverage.txt
|
||||
|
||||
serve:
|
||||
vars:
|
||||
DOCKER: docker
|
||||
cmds:
|
||||
- '{{.DOCKER}} run --rm -it -p 8000:8000 -v $PWD/www:/docs docker.io/squidfunk/mkdocs-material'
|
@ -23,9 +23,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
minioUser = "minio"
|
||||
minioPwd = "miniostorage"
|
||||
testBucket = "test"
|
||||
minioUser = "minio"
|
||||
minioPwd = "miniostorage"
|
||||
)
|
||||
|
||||
func TestMinioUpload(t *testing.T) {
|
||||
@ -45,7 +44,7 @@ func TestMinioUpload(t *testing.T) {
|
||||
Blobs: []config.Blob{
|
||||
{
|
||||
Provider: "s3",
|
||||
Bucket: testBucket,
|
||||
Bucket: "test",
|
||||
Region: "us-east",
|
||||
Endpoint: "http://" + listen,
|
||||
IDs: []string{"foo", "bar"},
|
||||
@ -147,7 +146,7 @@ func TestMinioUploadRootFolder(t *testing.T) {
|
||||
Blobs: []config.Blob{
|
||||
{
|
||||
Provider: "s3",
|
||||
Bucket: testBucket,
|
||||
Bucket: "test",
|
||||
Folder: "/",
|
||||
Endpoint: "http://" + listen,
|
||||
},
|
||||
@ -223,11 +222,6 @@ func prepareEnv() {
|
||||
|
||||
func start(tb testing.TB, name, listen string) {
|
||||
tb.Helper()
|
||||
tb.Cleanup(func() {
|
||||
if out, err := exec.Command("docker", "stop", name).CombinedOutput(); err != nil {
|
||||
tb.Fatalf("failed to stop minio: %s", string(out))
|
||||
}
|
||||
})
|
||||
|
||||
if out, err := exec.Command(
|
||||
"docker", "run", "-d", "--rm",
|
||||
@ -256,17 +250,27 @@ func start(tb testing.TB, name, listen string) {
|
||||
tb.Log("waiting for minio to be healthy")
|
||||
}
|
||||
|
||||
mc(tb, name, "mc mb local/test")
|
||||
|
||||
tb.Cleanup(func() {
|
||||
mc(tb, name, "mc rb --force local/test")
|
||||
if out, err := exec.Command("docker", "stop", name).CombinedOutput(); err != nil {
|
||||
tb.Fatalf("failed to stop minio: %s", string(out))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func mc(tb testing.TB, name, cmd string) {
|
||||
tb.Helper()
|
||||
|
||||
if out, err := exec.Command(
|
||||
"docker", "run", "--rm",
|
||||
"--link", name,
|
||||
"--entrypoint", "sh",
|
||||
"minio/mc",
|
||||
"-c", fmt.Sprintf(
|
||||
"mc config host add local http://%s:9000 %s %s; mc mb local/%s",
|
||||
name,
|
||||
minioUser,
|
||||
minioPwd,
|
||||
testBucket,
|
||||
"mc config host add local http://%s:9000 %s %s; %s",
|
||||
name, minioUser, minioPwd, cmd,
|
||||
),
|
||||
).CombinedOutput(); err != nil {
|
||||
tb.Fatalf("failed to create test bucket: %s", string(out))
|
||||
|
11
test.yml
Normal file
11
test.yml
Normal file
@ -0,0 +1,11 @@
|
||||
# This is an example .goreleaser.yml file with some sane defaults.
|
||||
# Make sure to check the documentation at https://goreleaser.com
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
goos: [darwin]
|
||||
goarch: [amd64]
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Version }}-next"
|
Loading…
x
Reference in New Issue
Block a user