Skip to content

Commit

Permalink
Merge pull request hashicorp#16214 from hashicorp/jbardin/registry-url
Browse files Browse the repository at this point in the history
remove extra slash from registry urls
  • Loading branch information
jbardin authored Sep 28, 2017
2 parents f45aae9 + 1fbb2d6 commit 60d8b6c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/module/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func getStorage(s getter.Storage, key string, src string, mode GetMode) (string,
}

const (
registryAPI = "https://registry.terraform.io/v1/modules/"
registryAPI = "https://registry.terraform.io/v1/modules"
xTerraformGet = "X-Terraform-Get"
)

Expand Down
18 changes: 15 additions & 3 deletions config/module/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestDetectRegistry(t *testing.T) {
defer server.Close()

detector := registryDetector{
api: server.URL + "/v1/modules/",
api: server.URL + "/v1/modules",
client: server.Client(),
}

Expand Down Expand Up @@ -181,7 +181,7 @@ func TestDetectors(t *testing.T) {
}

regDetector := &registryDetector{
api: server.URL + "/v1/modules/",
api: server.URL + "/v1/modules",
client: server.Client(),
}

Expand Down Expand Up @@ -280,7 +280,7 @@ func TestRegistryGitHubArchive(t *testing.T) {
defer server.Close()

regDetector := &registryDetector{
api: server.URL + "/v1/modules/",
api: server.URL + "/v1/modules",
client: server.Client(),
}

Expand Down Expand Up @@ -312,6 +312,18 @@ func TestRegistryGitHubArchive(t *testing.T) {
t.Fatalf("err: %s", err)
}

// stop the registry server, and make sure that we don't need to call out again
server.Close()
tree = NewTree("", testConfig(t, "registry-tar-subdir"))

if err := tree.Load(storage, GetModeGet); err != nil {
t.Fatalf("err: %s", err)
}

if !tree.Loaded() {
t.Fatal("should be loaded")
}

actual := strings.TrimSpace(tree.String())
expected := strings.TrimSpace(treeLoadSubdirStr)
if actual != expected {
Expand Down

0 comments on commit 60d8b6c

Please sign in to comment.