Skip to content

Commit

Permalink
appease the linter gods
Browse files Browse the repository at this point in the history
  • Loading branch information
gavincabbage committed Sep 18, 2019
1 parent 9826b19 commit 23acd45
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 58 deletions.
8 changes: 0 additions & 8 deletions chiv.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ type database interface {
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

type rows interface {
Close() error
ColumnTypes() ([]*sql.ColumnType, error)
Next() bool
Scan(...interface{}) error
Err() error
}

type uploader interface {
UploadWithContext(ctx aws.Context, input *s3manager.UploadInput, opts ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
}
Expand Down
54 changes: 27 additions & 27 deletions chiv_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package chiv_test

import (
"context"
"os"
"testing"

Expand Down Expand Up @@ -340,30 +341,29 @@ func TestArchiver_Archive(t *testing.T) {
}
}

//func TestArchiveWithContext(t *testing.T) {
// var (
// database = os.Getenv("POSTGRES_URL")
// driver = "postgres"
// bucket = "postgres_bucket"
// table = "postgres_table"
// setup = "./testdata/postgres/postgres_setup.sql"
// teardown = "./testdata/postgres/postgres_teardown.sql"
// expected = "./testdata/postgres/postgres.csv"
// db = newDB(t, driver, database)
// s3client = newS3Client(t, os.Getenv("AWS_REGION"), os.Getenv("AWS_ENDPOINT"))
// uploader = s3manager.NewUploaderWithClient(s3client)
// downloader = s3manager.NewDownloaderWithClient(s3client)
// )
//
// exec(t, db, readFile(t, setup))
// defer exec(t, db, readFile(t, teardown))
//
// createBucket(t, s3client, bucket)
// defer deleteBucket(t, s3client, bucket)
//
// var ()
// require.NoError(t, chiv.ArchiveWithContext(context.Background(), db, uploader, table, bucket))
//
// actual := download(t, downloader, bucket, table)
// require.Equal(t, readFile(t, expected), actual)
//}
func TestArchiveWithContext(t *testing.T) {
var (
database = os.Getenv("POSTGRES_URL")
driver = "postgres"
bucket = "postgres_bucket"
table = "postgres_table"
setup = "./testdata/postgres/postgres_setup.sql"
teardown = "./testdata/postgres/postgres_teardown.sql"
expected = "./testdata/postgres/postgres.csv"
db = newDB(t, driver, database)
s3client = newS3Client(t, os.Getenv("AWS_REGION"), os.Getenv("AWS_ENDPOINT"))
uploader = s3manager.NewUploaderWithClient(s3client)
downloader = s3manager.NewDownloaderWithClient(s3client)
)

exec(t, db, readFile(t, setup))
defer exec(t, db, readFile(t, teardown))

createBucket(t, s3client, bucket)
defer deleteBucket(t, s3client, bucket)

require.NoError(t, chiv.ArchiveWithContext(context.Background(), db, uploader, table, bucket))

actual := download(t, downloader, bucket, table)
require.Equal(t, readFile(t, expected), actual)
}
16 changes: 0 additions & 16 deletions chiv_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
// +build unit

package chiv_test

import (
"database/sql"
"testing"
)

func TestArchiver(t *testing.T) {

}

type database struct {
rows *sql.Rows
}

type uploader struct {
}
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmd
package main

import (
"fmt"
Expand Down
6 changes: 0 additions & 6 deletions formatters_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
// +build unit

package chiv_test

import "testing"

func TestCSV(t *testing.T) {

}
26 changes: 26 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,39 @@ module gavincabbage.com/chiv
go 1.13

require (
github.com/OpenPeeDeeP/depguard v1.0.1 // indirect
github.com/aws/aws-sdk-go v1.19.6
github.com/fatih/color v1.7.0 // indirect
github.com/go-sql-driver/mysql v1.4.1
github.com/gogo/protobuf v1.3.0 // indirect
github.com/golang/mock v1.3.1 // indirect
github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d // indirect
github.com/golangci/golangci-lint v1.18.0
github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039 // indirect
github.com/gostaticanalysis/analysisutil v0.0.3 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/lib/pq v1.0.0
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/testify v1.3.0
github.com/ultraware/funlen v0.0.2 // indirect
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7 // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20190918220241-b8f1ca6a929d // indirect
gopkg.in/yaml.v2 v2.2.2
mvdan.cc/unparam v0.0.0-20190917161559-b83a221c10a2 // indirect
sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
)

replace sourcegraph.com/sourcegraph/go-diff => github.com/sourcegraph/go-diff v0.5.1
Loading

0 comments on commit 23acd45

Please sign in to comment.