~artmello/ubuntu-push/ubuntu-push-fix_1611848

« back to all changes in this revision

Viewing changes to server/broker/broker_test.go

  • Committer: CI Train Bot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2015-04-30 15:08:54 UTC
  • mfrom: (145.1.2 ubuntu-push)
  • Revision ID: ci-train-bot@canonical.com-20150430150854-2u38lu0oi8rtomo1
[ Samuele Pedroni ]
* switch poller to use killswitch state for WLAN instead of misleading NM property (LP: #1446584)
* don't have goroutines from a previous test overlap with the next, races gets detected otherwise
* have the TestDialWorksDirect* tests quickly timeout, go1.3 wants a ServerName set in the tls config for them to work
* fix flaky test
* support sha384/512 certs, some exercizing of that
* let send a build number with acceptanceclient
* add helper to get int out of ConnectMsg Info
Approved by: Samuele Pedroni

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
package broker
18
18
 
19
19
import (
 
20
        "encoding/json"
20
21
        "fmt"
21
22
 
22
23
        . "launchpad.net/gocheck"
48
49
        v, err = GetInfoString(connectMsg, "foo", "?")
49
50
        c.Check(err, Equals, ErrUnexpectedValue)
50
51
}
 
52
 
 
53
func (s *brokerSuite) TestGetInfoInt(c *C) {
 
54
        connectMsg := &protocol.ConnectMsg{}
 
55
        v, err := GetInfoInt(connectMsg, "bar", -1)
 
56
        c.Check(err, IsNil)
 
57
        c.Check(v, Equals, -1)
 
58
 
 
59
        err = json.Unmarshal([]byte(`{"bar": 233}`), &connectMsg.Info)
 
60
        c.Assert(err, IsNil)
 
61
        v, err = GetInfoInt(connectMsg, "bar", -1)
 
62
        c.Check(err, IsNil)
 
63
        c.Check(v, Equals, 233)
 
64
 
 
65
        connectMsg.Info["bar"] = "garbage"
 
66
        v, err = GetInfoInt(connectMsg, "bar", -1)
 
67
        c.Check(err, Equals, ErrUnexpectedValue)
 
68
}