Small code enhancements
This commit is contained in:
parent
015cd7a3d0
commit
9cd47dd2aa
41 changed files with 187 additions and 85 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/containous/traefik/integration/try"
|
||||
"github.com/containous/traefik/log"
|
||||
"github.com/containous/traefik/middlewares/accesslog"
|
||||
"github.com/go-check/check"
|
||||
checker "github.com/vdemeester/shakers"
|
||||
|
@ -324,13 +325,17 @@ func digestParts(resp *http.Response) map[string]string {
|
|||
|
||||
func getMD5(data string) string {
|
||||
digest := md5.New()
|
||||
digest.Write([]byte(data))
|
||||
if _, err := digest.Write([]byte(data)); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
return fmt.Sprintf("%x", digest.Sum(nil))
|
||||
}
|
||||
|
||||
func getCnonce() string {
|
||||
b := make([]byte, 8)
|
||||
io.ReadFull(rand.Reader, b)
|
||||
if _, err := io.ReadFull(rand.Reader, b); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
return fmt.Sprintf("%x", b)[:16]
|
||||
}
|
||||
|
||||
|
|
|
@ -530,7 +530,8 @@ func (s *ConsulCatalogSuite) TestRetryWithConsulServer(c *check.C) {
|
|||
|
||||
// Scale consul to 1
|
||||
s.composeProject.Scale(c, "consul", 1)
|
||||
s.waitToElectConsulLeader()
|
||||
err = s.waitToElectConsulLeader()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
whoami := s.composeProject.Container(c, "whoami1")
|
||||
// Register service
|
||||
|
@ -576,7 +577,8 @@ func (s *ConsulCatalogSuite) TestServiceWithMultipleHealthCheck(c *check.C) {
|
|||
|
||||
// Scale consul to 1
|
||||
s.composeProject.Scale(c, "consul", 1)
|
||||
s.waitToElectConsulLeader()
|
||||
err = s.waitToElectConsulLeader()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
whoami := s.composeProject.Container(c, "whoami1")
|
||||
// Register service
|
||||
|
|
|
@ -404,7 +404,8 @@ func (s *Etcd3Suite) TestCommandStoreConfig(c *check.C) {
|
|||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// wait for traefik finish without error
|
||||
cmd.Wait()
|
||||
err = cmd.Wait()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// CHECK
|
||||
checkmap := map[string]string{
|
||||
|
|
|
@ -411,8 +411,9 @@ func (s *EtcdSuite) TestCommandStoreConfig(c *check.C) {
|
|||
err := cmd.Start()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// wait for Træfik finish without error
|
||||
cmd.Wait()
|
||||
// wait for traefik finish without error
|
||||
err = cmd.Wait()
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// CHECK
|
||||
checkmap := map[string]string{
|
||||
|
|
|
@ -93,7 +93,9 @@ func (s *handler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {
|
|||
auth.Minttl = 1
|
||||
m.Ns = append(m.Ns, auth)
|
||||
|
||||
w.WriteMsg(m)
|
||||
if err := w.WriteMsg(m); err != nil {
|
||||
log.Fatalf("Failed to write message %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func startFakeDNSServer() *dns.Server {
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/containous/traefik/integration/helloworld"
|
||||
"github.com/containous/traefik/integration/try"
|
||||
"github.com/containous/traefik/log"
|
||||
"github.com/go-check/check"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
@ -47,7 +48,11 @@ func (s *myserver) StreamExample(in *helloworld.StreamExampleRequest, server hel
|
|||
for i := range data {
|
||||
data[i] = randCharset[rand.Intn(len(randCharset))]
|
||||
}
|
||||
server.Send(&helloworld.StreamExampleReply{Data: string(data)})
|
||||
|
||||
if err := server.Send(&helloworld.StreamExampleReply{Data: string(data)}); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
||||
<-s.stopStreamExample
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -708,7 +708,10 @@ func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, en
|
|||
defer func() {
|
||||
f.Close()
|
||||
}()
|
||||
f.Truncate(0)
|
||||
|
||||
err = f.Truncate(0)
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// If certificate file is not provided, just truncate the configuration file
|
||||
if len(certFileName) > 0 {
|
||||
tlsConf := types.Configuration{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue