MCPcopy Create free account
hub / github.com/docker/buildx / TestGitRemoteURL

Function TestGitRemoteURL

util/gitutil/gitutil_test.go:122–240  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

120}
121
122func TestGitRemoteURL(t *testing.T) {
123 ctx := context.TODO()
124 type remote struct {
125 name string
126 url string
127 tracking string
128 }
129
130 cases := []struct {
131 name string
132 remotes []remote
133 expected string
134 fail bool
135 }{
136 {
137 name: "no remotes",
138 remotes: []remote{},
139 fail: true,
140 },
141 {
142 name: "origin",
143 remotes: []remote{
144 {
145 name: "origin",
146 url: "git@github.com:crazy-max/buildx.git",
147 },
148 },
149 expected: "git@github.com:crazy-max/buildx.git",
150 },
151 {
152 name: "upstream",
153 remotes: []remote{
154 {
155 name: "upstream",
156 url: "git@github.com:docker/buildx.git",
157 },
158 },
159 expected: "git@github.com:docker/buildx.git",
160 },
161 {
162 name: "origin and upstream",
163 remotes: []remote{
164 {
165 name: "upstream",
166 url: "git@github.com:docker/buildx.git",
167 },
168 {
169 name: "origin",
170 url: "git@github.com:crazy-max/buildx.git",
171 },
172 },
173 expected: "git@github.com:crazy-max/buildx.git",
174 },
175 {
176 name: "not found",
177 remotes: []remote{
178 {
179 name: "foo",

Callers

nothing calls this directly

Calls 10

MktmpFunction · 0.92
NewFunction · 0.92
GitInitFunction · 0.92
GitCommitFunction · 0.92
GitSetRemoteFunction · 0.92
GitSetMainUpstreamFunction · 0.92
RunMethod · 0.80
RemoteURLMethod · 0.80
EqualMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…