| 1 |
/* |
| 2 |
Copyright 2013-2014 Canonical Ltd. |
| 3 |
|
| 4 |
This program is free software: you can redistribute it and/or modify it |
| 5 |
under the terms of the GNU General Public License version 3, as published |
| 6 |
by the Free Software Foundation. |
| 7 |
|
| 8 |
This program is distributed in the hope that it will be useful, but |
| 9 |
WITHOUT ANY WARRANTY; without even the implied warranties of |
| 10 |
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 11 |
PURPOSE. See the GNU General Public License for more details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU General Public License along |
| 14 |
with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
package server |
| 18 |
|
| 19 |
import ( |
| 20 |
"net" |
| 21 |
"testing" |
| 22 |
|
| 23 |
. "gopkg.in/check.v1" |
| 24 |
|
| 25 |
helpers "gitlab.com/ubports/development/core/lomiri-push-service/testing" |
| 26 |
) |
| 27 |
|
| 28 |
func TestRunners(t *testing.T) { TestingT(t) } |
| 29 |
|
| 30 |
type bootlogSuite struct{} |
| 31 |
|
| 32 |
var _ = Suite(&bootlogSuite{}) |
| 33 |
|
| 34 |
func (s *bootlogSuite) TestBootLogListener(c *C) { |
| 35 |
prevBootLogger := BootLogger |
| 36 |
testlog := helpers.NewTestLogger(c, "info") |
| 37 |
BootLogger = testlog |
| 38 |
defer func() { |
| 39 |
BootLogger = prevBootLogger |
| 40 |
}() |
| 41 |
lst, err := net.Listen("tcp", "127.0.0.1:0") |
| 42 |
c.Assert(err, IsNil) |
| 43 |
defer lst.Close() |
| 44 |
BootLogListener("client", lst) |
| 45 |
c.Check(testlog.Captured(), Matches, "INFO listening for client on "+lst.Addr().String()+"\n") |
| 46 |
} |