Fixed integration builds under Jenkins

... had to give TTY to Docker container which executed the test
This commit is contained in:
Ev Kontsevoy 2016-04-14 14:42:10 -07:00
parent 42c4eaf269
commit e4023519d0
4 changed files with 21 additions and 7 deletions

View file

@ -78,6 +78,12 @@ test:
$(PKGPATH)/tool/teleport... $(FLAGS) -tags test
go vet ./tool/... ./lib/...
#
# integration tests. need a TTY to work and not compatible with a race detector
#
.PHONY: integration
integration:
go test -v $(PKGPATH)/integration/...
#
# source-release releases source distribution tarball for this particular version

View file

@ -57,4 +57,6 @@ ENV LANGUAGE="en_US.UTF-8" \
PATH="$PATH:/opt/go/bin:/gopath/bin" \
GO15VENDOREXPERIMENT="1"
RUN /opt/go/bin/go get github.com/gravitational/version/cmd/linkflags
VOLUME ["/gopath/src/github.com/gravitational/teleport"]

View file

@ -23,16 +23,20 @@ build: bbox
bbox:
docker build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) --tag $(BBOX) .
#
# Runs tests inside a build container
#
.PHONY:test
test:
test: integration
docker run $(DOCKERFLAGS) $(NOROOT) -t $(BBOX) \
/bin/bash -c "$(MAKE) -C $(SRCDIR) TELEPORT_DEBUG_TESTS=true FLAGS='-cover -race' clean test"
.PHONY:integration
integration: bbox
docker run $(DOCKERFLAGS) $(NOROOT) -i $(BBOX) \
/bin/bash -c "$(MAKE) -C $(SRCDIR) TELEPORT_DEBUG_TESTS=false FLAGS='-cover' integration"
#
# Builds docs
#

View file

@ -76,9 +76,11 @@ func (s *IntSuite) SetUpSuite(c *check.C) {
s.me, _ = user.Current()
// close & re-open stdin because 'go test' runs with os.stdin connected to /dev/null
os.Stdin.Close()
os.Stdin, err = os.Open("/dev/tty")
c.Assert(err, check.IsNil)
stdin, err := os.Open("/dev/tty")
if err != nil {
os.Stdin.Close()
os.Stdin = stdin
}
}
// newTeleport helper returns a running Teleport instance pre-configured
@ -126,12 +128,12 @@ func (s *IntSuite) TestInteractive(c *check.C) {
cl, err := t.NewClient(s.me.Username, Site, Host, t.GetPortSSHInt())
c.Assert(err, check.IsNil)
cl.Output = &personB
for i := 0; i < 3; i++ {
for i := 0; i < 10; i++ {
time.Sleep(time.Millisecond * 5)
err = cl.Join(sessionID, &personB)
if err == nil {
break
}
time.Sleep(time.Millisecond * 5)
}
c.Assert(err, check.IsNil)
}