Skip to content

Commit

Permalink
Merge pull request #190 from hashicorp/testdata-dir
Browse files Browse the repository at this point in the history
Use standard name for fixtures dir per Go conventions
  • Loading branch information
radeksimko authored Jul 15, 2019
2 parents da0323b + 3519467 commit 30a49e4
Show file tree
Hide file tree
Showing 117 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ go-getter will first download the URL specified _before_ the double-slash
path after the double slash into the target directory.

For example, if you're downloading this GitHub repository, but you only
want to download the `test-fixtures` directory, you can do the following:
want to download the `testdata` directory, you can do the following:

```
https://github.com/hashicorp/go-getter.git//test-fixtures
https://github.com/hashicorp/go-getter.git//testdata
```

If you downloaded this to the `/tmp` directory, then the file
`/tmp/archive.gz` would exist. Notice that this file is in the `test-fixtures`
`/tmp/archive.gz` would exist. Notice that this file is in the `testdata`
directory in this repository, but because we specified a subdirectory,
go-getter automatically copied only that directory contents.

Expand Down
2 changes: 1 addition & 1 deletion decompress_bzip2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestBzip2Decompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-bz2", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-bz2", tc.Input)
}

TestDecompressor(t, new(Bzip2Decompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestGzipDecompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-gz", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-gz", tc.Input)
}

TestDecompressor(t, new(GzipDecompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_tar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestTar(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-tar", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-tar", tc.Input)
}

TestDecompressor(t, new(tarDecompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_tbz2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestTarBzip2Decompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-tbz2", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-tbz2", tc.Input)
}

TestDecompressor(t, new(TarBzip2Decompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_tgz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestTarGzipDecompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-tgz", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-tgz", tc.Input)
}

TestDecompressor(t, new(TarGzipDecompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_txz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestTarXzDecompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-txz", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-txz", tc.Input)
}

TestDecompressor(t, new(TarXzDecompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_xz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestXzDecompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-xz", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-xz", tc.Input)
}

TestDecompressor(t, new(XzDecompressor), cases)
Expand Down
2 changes: 1 addition & 1 deletion decompress_zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func TestZipDecompressor(t *testing.T) {
}

for i, tc := range cases {
cases[i].Input = filepath.Join("./test-fixtures", "decompress-zip", tc.Input)
cases[i].Input = filepath.Join("./testdata", "decompress-zip", tc.Input)
}

TestDecompressor(t, new(ZipDecompressor), cases)
Expand Down
4 changes: 2 additions & 2 deletions detect_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var fileTests = []fileTest{
}

var unixFileTests = []fileTest{
{"./foo", "test-fixtures/detect-file-symlink-pwd/syml/pwd",
"test-fixtures/detect-file-symlink-pwd/real/foo", false},
{"./foo", "testdata/detect-file-symlink-pwd/syml/pwd",
"testdata/detect-file-symlink-pwd/real/foo", false},

{"/foo", "/pwd", "file:///foo", false},
{"/foo?bar=baz", "/pwd", "file:///foo?bar=baz", false},
Expand Down
8 changes: 4 additions & 4 deletions get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestGet_filePercent2F(t *testing.T) {

func TestGet_fileDetect(t *testing.T) {
dst := tempDir(t)
u := filepath.Join(".", "test-fixtures", "basic")
u := filepath.Join(".", "testdata", "basic")
pwd, err := os.Getwd()
if err != nil {
t.Fatalf("err: %s", err)
Expand Down Expand Up @@ -121,7 +121,7 @@ func TestGet_fileSubdir(t *testing.T) {

func TestGet_archive(t *testing.T) {
dst := tempDir(t)
u := filepath.Join("./test-fixtures", "archive.tar.gz")
u := filepath.Join("./testdata", "archive.tar.gz")
u, _ = filepath.Abs(u)

if err := Get(dst, u); err != nil {
Expand All @@ -136,7 +136,7 @@ func TestGet_archive(t *testing.T) {

func TestGetAny_archive(t *testing.T) {
dst := tempDir(t)
u := filepath.Join("./test-fixtures", "archive.tar.gz")
u := filepath.Join("./testdata", "archive.tar.gz")
u, _ = filepath.Abs(u)

if err := GetAny(dst, u); err != nil {
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestGetAny_file(t *testing.T) {

func TestGetAny_dir(t *testing.T) {
dst := tempDir(t)
u := filepath.Join("./test-fixtures", "basic")
u := filepath.Join("./testdata", "basic")
u, _ = filepath.Abs(u)

if err := GetAny(dst, u); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
urlhelper "github.com/hashicorp/go-getter/helper/url"
)

const fixtureDir = "./test-fixtures"
const fixtureDir = "./testdata"

func tempDir(t *testing.T) string {
dir, err := ioutil.TempDir("", "tf")
Expand Down
6 changes: 3 additions & 3 deletions netrc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestAddAuthFromNetrc(t *testing.T) {
defer tempEnv(t, "NETRC", "./test-fixtures/netrc/basic")()
defer tempEnv(t, "NETRC", "./testdata/netrc/basic")()

u, err := url.Parse("http://example.com")
if err != nil {
Expand All @@ -25,7 +25,7 @@ func TestAddAuthFromNetrc(t *testing.T) {
}

func TestAddAuthFromNetrc_hasAuth(t *testing.T) {
defer tempEnv(t, "NETRC", "./test-fixtures/netrc/basic")()
defer tempEnv(t, "NETRC", "./testdata/netrc/basic")()

u, err := url.Parse("http://username:password@example.com")
if err != nil {
Expand All @@ -44,7 +44,7 @@ func TestAddAuthFromNetrc_hasAuth(t *testing.T) {
}

func TestAddAuthFromNetrc_hasUsername(t *testing.T) {
defer tempEnv(t, "NETRC", "./test-fixtures/netrc/basic")()
defer tempEnv(t, "NETRC", "./testdata/netrc/basic")()

u, err := url.Parse("http://username@example.com")
if err != nil {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 30a49e4

Please sign in to comment.