config/module: test Git

This commit is contained in:
Mitchell Hashimoto 2014-09-15 23:52:27 -07:00
parent acb6d12a75
commit 3e2989daf1
4 changed files with 37 additions and 10 deletions

View File

@ -1,7 +1,6 @@
package module
import (
"net/url"
"os"
"path/filepath"
"testing"
@ -103,12 +102,3 @@ func TestFileGetter_dirSymlink(t *testing.T) {
t.Fatalf("err: %s", err)
}
}
func testModuleURL(n string) *url.URL {
u, err := url.Parse(testModule(n))
if err != nil {
panic(err)
}
return u
}

View File

@ -0,0 +1,27 @@
package module
import (
"os"
"path/filepath"
"testing"
)
func TestGitGetter_impl(t *testing.T) {
var _ Getter = new(GitGetter)
}
func TestGitGetter(t *testing.T) {
g := new(GitGetter)
dst := tempDir(t)
// With a dir that doesn't exist
if err := g.Get(dst, testModuleURL("basic-git")); err != nil {
t.Fatalf("err: %s", err)
}
// Verify the main file exists
mainPath := filepath.Join(dst, "main.tf")
if _, err := os.Stat(mainPath); err != nil {
t.Fatalf("err: %s", err)
}
}

View File

@ -46,6 +46,15 @@ func testModule(n string) string {
return url.String()
}
func testModuleURL(n string) *url.URL {
u, err := url.Parse(testModule(n))
if err != nil {
panic(err)
}
return u
}
func testStorage(t *testing.T) Storage {
return &FolderStorage{StorageDir: tempDir(t)}
}

@ -0,0 +1 @@
Subproject commit 7f872b3fd8504ba63330261b35073a1c4f35383d