mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-02 14:46:31 +00:00
52d8097290
We previously got the machine hostname for Netrc from the url of the remote, but in cases where the clone-url does not match the api url this can lead to errors.
18 lines
358 B
Go
18 lines
358 B
Go
package common_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/woodpecker-ci/woodpecker/server/remote/common"
|
|
)
|
|
|
|
func Test_Netrc(t *testing.T) {
|
|
host, err := common.ExtractHostFromCloneURL("https://git.example.com/foo/bar.git")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if host != "git.example.com" {
|
|
t.Errorf("Expected host to be git.example.com, got %s", host)
|
|
}
|
|
}
|