mirror of
https://github.com/int128/kubelogin.git
synced 2026-02-14 16:39:51 +00:00
@@ -13,6 +13,8 @@ jobs:
|
||||
- run: |
|
||||
curl -L -o ~/bin/ghcp https://github.com/int128/ghcp/releases/download/v1.3.0/ghcp_linux_amd64
|
||||
chmod +x ~/bin/ghcp
|
||||
- run: |
|
||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b ~/bin v1.16.0
|
||||
- run: go get github.com/int128/goxzst
|
||||
- run: go get github.com/tcnksm/ghr
|
||||
- checkout
|
||||
|
||||
2
Makefile
2
Makefile
@@ -8,7 +8,7 @@ LDFLAGS := -X main.version=$(CIRCLE_TAG)
|
||||
all: $(TARGET)
|
||||
|
||||
check:
|
||||
go vet
|
||||
golangci-lint run
|
||||
$(MAKE) -C adaptors_test/keys/testdata
|
||||
go test -v -race ./...
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ func (c *httpClientConfig) AddCertificateFromFile(filename string) error {
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "could not read %s", filename)
|
||||
}
|
||||
if c.certPool.AppendCertsFromPEM(b) != true {
|
||||
if !c.certPool.AppendCertsFromPEM(b) {
|
||||
return errors.Errorf("could not append certificate from %s", filename)
|
||||
}
|
||||
return nil
|
||||
@@ -61,7 +61,7 @@ func (c *httpClientConfig) AddEncodedCertificate(base64String string) error {
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "could not decode base64")
|
||||
}
|
||||
if c.certPool.AppendCertsFromPEM(b) != true {
|
||||
if !c.certPool.AppendCertsFromPEM(b) {
|
||||
return errors.Errorf("could not append certificate")
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -40,7 +40,7 @@ func TestCmd_Run(t *testing.T) {
|
||||
RefreshToken: "REFRESH_TOKEN",
|
||||
}
|
||||
server := authserver.Start(t, serverConfig)
|
||||
defer server.Shutdown(ctx)
|
||||
defer shutdown(t, ctx, server)
|
||||
|
||||
kubeConfigFilename := kubeconfig.Create(t, &kubeconfig.Values{
|
||||
Issuer: "http://localhost:9000",
|
||||
@@ -67,7 +67,7 @@ func TestCmd_Run(t *testing.T) {
|
||||
RefreshToken: "REFRESH_TOKEN",
|
||||
}
|
||||
server := authserver.Start(t, serverConfig)
|
||||
defer server.Shutdown(ctx)
|
||||
defer shutdown(t, ctx, server)
|
||||
|
||||
kubeConfigFilename := kubeconfig.Create(t, &kubeconfig.Values{
|
||||
Issuer: "http://localhost:9000",
|
||||
@@ -98,7 +98,7 @@ func TestCmd_Run(t *testing.T) {
|
||||
Scope: "profile groups openid",
|
||||
}
|
||||
server := authserver.Start(t, serverConfig)
|
||||
defer server.Shutdown(ctx)
|
||||
defer shutdown(t, ctx, server)
|
||||
|
||||
kubeConfigFilename := kubeconfig.Create(t, &kubeconfig.Values{
|
||||
Issuer: "http://localhost:9000",
|
||||
@@ -128,7 +128,7 @@ func TestCmd_Run(t *testing.T) {
|
||||
TLSServerKey: keys.TLSServerKey,
|
||||
}
|
||||
server := authserver.Start(t, serverConfig)
|
||||
defer server.Shutdown(ctx)
|
||||
defer shutdown(t, ctx, server)
|
||||
|
||||
kubeConfigFilename := kubeconfig.Create(t, &kubeconfig.Values{
|
||||
Issuer: "https://localhost:9000",
|
||||
@@ -158,7 +158,7 @@ func TestCmd_Run(t *testing.T) {
|
||||
TLSServerKey: keys.TLSServerKey,
|
||||
}
|
||||
server := authserver.Start(t, serverConfig)
|
||||
defer server.Shutdown(ctx)
|
||||
defer shutdown(t, ctx, server)
|
||||
|
||||
kubeConfigFilename := kubeconfig.Create(t, &kubeconfig.Values{
|
||||
Issuer: "https://localhost:9000",
|
||||
@@ -183,7 +183,7 @@ func TestCmd_Run(t *testing.T) {
|
||||
IDTokenKeyPair: keys.JWSKeyPair,
|
||||
}
|
||||
server := authserver.Start(t, serverConfig)
|
||||
defer server.Shutdown(ctx)
|
||||
defer shutdown(t, ctx, server)
|
||||
|
||||
idToken := newIDToken(t, "http://localhost:9000")
|
||||
kubeConfigFilename := kubeconfig.Create(t, &kubeconfig.Values{
|
||||
@@ -259,6 +259,12 @@ func startBrowserRequest(t *testing.T, ctx context.Context, tlsConfig *tls.Confi
|
||||
}()
|
||||
}
|
||||
|
||||
func shutdown(t *testing.T, ctx context.Context, s *http.Server) {
|
||||
if err := s.Shutdown(ctx); err != nil {
|
||||
t.Errorf("Could not shutdown the auth server: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func setenv(t *testing.T, key, value string) {
|
||||
t.Helper()
|
||||
if err := os.Setenv(key, value); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user