Skip to content

Commit

Permalink
enable testing with no active configuration (#1215)
Browse files Browse the repository at this point in the history
  • Loading branch information
theganyo authored Jul 27, 2023
1 parent 5c4748c commit 74166d9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg/connection/grpctest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,19 @@ func NewServer(rc registry.Config) (*Server, error) {

// set registry configuration to use test server
addr := fmt.Sprintf("localhost:%d", s.Port())
config, err := connection.ActiveConfig()
conf, err := connection.ActiveConfig()
if err != nil {
return nil, err
if ve, ok := err.(config.ValidationError); ok {
if ve.Field != "registry.address" {
return nil, err
}
} else {
return nil, err
}
}
config.Insecure = true
config.Address = addr
connection.SetConfig(config)
conf.Insecure = true
conf.Address = addr
connection.SetConfig(conf)

return s, nil
}
Expand Down

0 comments on commit 74166d9

Please sign in to comment.