-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: host builder basic auth * update tests * mark oci basic auth flags hidden * cleanup - Remove debug statements - Fix test race - Update licenses * spelling and linting errors
- Loading branch information
Showing
13 changed files
with
578 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package mock | ||
|
||
import ( | ||
"log" | ||
"net" | ||
"net/http" | ||
"net/http/httptest" | ||
"os" | ||
|
||
impl "github.com/google/go-containerregistry/pkg/registry" | ||
) | ||
|
||
type Registry struct { | ||
*httptest.Server | ||
|
||
HandlerFunc http.HandlerFunc | ||
RegistryImpl http.Handler | ||
} | ||
|
||
func NewRegistry() *Registry { | ||
registryHandler := impl.New(impl.Logger(log.New(os.Stderr, "test registry: ", log.LstdFlags))) | ||
r := &Registry{ | ||
RegistryImpl: registryHandler, | ||
} | ||
r.Server = httptest.NewServer(r) | ||
|
||
return r | ||
} | ||
|
||
func (r *Registry) Addr() net.Addr { | ||
return r.Server.Listener.Addr() | ||
} | ||
|
||
func (r *Registry) Close() { | ||
r.Server.Close() | ||
} | ||
|
||
func (r *Registry) ServeHTTP(res http.ResponseWriter, req *http.Request) { | ||
if r.HandlerFunc != nil { | ||
r.HandlerFunc(res, req) | ||
} else { | ||
r.RegistryImpl.ServeHTTP(res, req) | ||
} | ||
} |
Oops, something went wrong.