mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 16:31:10 -06:00
Add basic ACC test
This just does a lookup in the registry to verify that the download api works.
This commit is contained in:
parent
ba14cf9511
commit
3d3992454e
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@ -246,3 +247,28 @@ func TestDetectors(t *testing.T) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccRegistryDiscover(t *testing.T) {
|
||||
if os.Getenv("TF_ACC") == "" {
|
||||
t.Skip("skipping ACC test")
|
||||
}
|
||||
|
||||
// simply check that we get a valid github URL for this from the registry
|
||||
loc, err := getter.Detect("hashicorp/consul/aws", "./", detectors)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
u, err := url.Parse(loc)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(u.Host, "github.com") {
|
||||
t.Fatalf("expected host 'github.com', got: %q", u.Host)
|
||||
}
|
||||
|
||||
if !strings.Contains(u.String(), "consul") {
|
||||
t.Fatalf("url doesn't contain 'consul': %s", u.String())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user