diff --git a/cmd/cogito/main_test.go b/cmd/cogito/main_test.go index b1824240..e869348a 100644 --- a/cmd/cogito/main_test.go +++ b/cmd/cogito/main_test.go @@ -64,9 +64,7 @@ func TestRunPutSuccess(t *testing.T) { var ghUrl *url.URL gitHubSpy := testhelp.SpyHttpServer(&ghReq, nil, &ghUrl, http.StatusCreated) gitHubSpyURL, err := url.Parse(gitHubSpy.URL) - if err != nil { - t.Fatalf("error parsing SpyHttpServer URL: %s", err) - } + assert.NilError(t, err, "error parsing SpyHttpServer URL: %s", err) var chatMsg googlechat.BasicMessage chatReply := googlechat.MessageReply{} var gchatUrl *url.URL diff --git a/cogito/ghcommitsink_test.go b/cogito/ghcommitsink_test.go index d74c0fc0..a429ca49 100644 --- a/cogito/ghcommitsink_test.go +++ b/cogito/ghcommitsink_test.go @@ -24,9 +24,7 @@ func TestSinkGitHubCommitStatusSendSuccess(t *testing.T) { var URL *url.URL ts := testhelp.SpyHttpServer(&ghReq, nil, &URL, http.StatusCreated) gitHubSpyURL, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("error parsing SpyHttpServer URL: %s", err) - } + assert.NilError(t, err, "error parsing SpyHttpServer URL: %s", err) sink := cogito.GitHubCommitStatusSink{ Log: hclog.NewNullLogger(), GitRef: wantGitRef, @@ -52,9 +50,7 @@ func TestSinkGitHubCommitStatusSendFailure(t *testing.T) { w.WriteHeader(http.StatusTeapot) })) gitHubSpyURL, err := url.Parse(ts.URL) - if err != nil { - t.Fatalf("error parsing SpyHttpServer URL: %s", err) - } + assert.NilError(t, err, "error parsing SpyHttpServer URL: %s", err) defer ts.Close() sink := cogito.GitHubCommitStatusSink{ Log: hclog.NewNullLogger(), diff --git a/github/commitstatus.go b/github/commitstatus.go index b1e688af..d4fde7c1 100644 --- a/github/commitstatus.go +++ b/github/commitstatus.go @@ -31,10 +31,10 @@ func (e *StatusError) Error() string { return fmt.Sprintf("%s\n%s", e.What, e.Details) } -// Default GitHub hostname +// GhDefaultHostname is the default GitHub hostname (used for git but not for the API) const GhDefaultHostname = "github.com" -// API is the GitHub API endpoint. +// API is the default GitHub API hostname. const API = "https://api.github.com" type Target struct { diff --git a/testhelp/testhelper.go b/testhelp/testhelper.go index a5cc70f8..24222860 100644 --- a/testhelp/testhelper.go +++ b/testhelp/testhelper.go @@ -247,18 +247,18 @@ func MakeGitRepoFromTestdata( } // SshRemote returns a GitHub SSH URL -func SshRemote(domain, owner, repo string) string { - return fmt.Sprintf("git@%s:%s/%s.git", domain, owner, repo) +func SshRemote(hostname, owner, repo string) string { + return fmt.Sprintf("git@%s:%s/%s.git", hostname, owner, repo) } // HttpsRemote returns a GitHub HTTPS URL -func HttpsRemote(domain, owner, repo string) string { - return fmt.Sprintf("https://%s/%s/%s.git", domain, owner, repo) +func HttpsRemote(hostname, owner, repo string) string { + return fmt.Sprintf("https://%s/%s/%s.git", hostname, owner, repo) } // HttpRemote returns a GitHub HTTP URL -func HttpRemote(domain, owner, repo string) string { - return fmt.Sprintf("http://%s/%s/%s.git", domain, owner, repo) +func HttpRemote(hostname, owner, repo string) string { + return fmt.Sprintf("http://%s/%s/%s.git", hostname, owner, repo) } // ToJSON returns the JSON encoding of thing.